﻿ 

function searchToolbar(){
    var searchString;
    searchString = document.getElementById("searchvalue").value;
    if (searchString != "" && searchString != "Search here for the Toolbar you want"){
    //alert(searchString);
    window.location = "/toolbars/"+searchString+".aspx";
    }
    else return;
    }
   /* function parseGetVars() {
	var getVars = new Array();
	var qString = unescape(top.location.search.substring(1));
	var pairs = qString.split(/\&/);
	for (var i in pairs) {
		var nameVal = pairs[i].split(/\=/);
		getVars[nameVal[0]] = nameVal[1];
		}	
	return getVars;
	}
	*/
	function insertsearchString(){
    //var g = parseGetVars();
    //var searchString = g['search'];
    var searchPosition = null;
    var currentLocation = top.location;
    var currentLocationString = currentLocation.toString();
    var substringLocation = currentLocationString.split("/");
    var substringLocationLength = substringLocation.length;
    for (var i=0; i<=(substringLocationLength-1); i++){
        if(substringLocation[i] == "toolbars"){
            searchPosition = i;
            }
        }
    var searchStringAspx = substringLocation[searchPosition+1].split(".");
    var searchString = searchStringAspx[0];
    searchString = decodeURIComponent(searchString);
    if(searchPosition == null){
    document.getElementById("searchvalue").style.fontSize = "14px";
    document.getElementById("searchvalue").style.color = "#BCBCBC";
    document.getElementById("searchvalue").style.paddingTop = "10px";
    document.getElementById("searchvalue").style.height = "26px";
    document.getElementById("searchvalue").value = "Search here for the Toolbar you want";
    //document.getElementById("searchvalue").style.fontWeight = "bold";
    //alert(document.getElementById("searchvalue").value);
    }
    else{
    document.getElementById("searchvalue").value = searchString;
     //alert(document.getElementById("searchvalue").value);
    }
    }
    function clearTextFromField(){
        if(document.getElementById("searchvalue").value == "Search here for the Toolbar you want"){
        document.getElementById("searchvalue").style.fontSize = "22px";
        document.getElementById("searchvalue").style.color = "#000000";
        document.getElementById("searchvalue").style.paddingTop = "6px";
        document.getElementById("searchvalue").style.height = "30px";
        document.getElementById("searchvalue").value = "";
        //document.getElementById("searchvalue").style.fontWeight = "normal";
        }
        }
    function insertTextToSearchField(){
    if(document.getElementById("searchvalue").value == "Search here for the Toolbar you want" || document.getElementById("searchvalue").value == ""){
        document.getElementById("searchvalue").style.fontSize = "14px";
        document.getElementById("searchvalue").style.color = "#BCBCBC";
        document.getElementById("searchvalue").style.paddingTop = "10px";
        document.getElementById("searchvalue").style.height = "26px";
        document.getElementById("searchvalue").value = "Search here for the Toolbar you want";
        //document.getElementById("searchvalue").style.fontWeight = "bold";
    }
    else{
    
    }
    
    }
   
    function detectEnter(ev) {
        arrows=((ev.which)||(ev.keyCode));
        switch(arrows) {
        case 13:
        searchToolbar();
        break;
        }
    }

  function hide_submit( elementId, content ){
          if( document.all ){
            document.all( elementId ).innerHTML = content;
            }
          else if( document.getElementById ){
                rng = document.createRange();
                el = document.getElementById( elementId );
                rng.setStartBefore( el );
                htmlFrag = rng.createContextualFragment( content );
                while( el.hasChildNodes() ){
                    el.removeChild( el.lastChild );
                     }
                el.appendChild( htmlFrag );
            }
            return false;
            document.form.submit();
            }
    function noenter() {
        return !(window.event && window.event.keyCode == 13);
        }
