// JavaScript Document
//Tag Search - Created by Short-Hair-Style.com , SIS sep.2009
//<![CDATA[

    google.load("search", "1");

function OnLoad() {
// Create a search control
var searchControl = new google.search.SearchControl();
var drawOptions = new google.search.DrawOptions();
var SHSSearch = new google.search.WebSearch();
var tags = ['comment', 'form', 'thank', 'with'];
var query ="";
var pageUrl;
if(top == self) {
   pageUrl = document.location.href;
} else {
   pageUrl = document.referrer;
}
$basename=basename(pageUrl,'.html');
if (strstr($basename,'-'))
{$delim='-';}else{$delim='_';}
var keytag=$basename.split($delim);
for (var i=0;i<4;i++)
{
if ( (keytag[i].length>3) &&  !(in_array(keytag[i], tags ) )) {
//GA_googleAddAttr("Keytag",keytag[i]);
query=query+' '+keytag[i];
 }
}

SHSSearch.setUserDefinedLabel("SHS Search Result");
SHSSearch.setUserDefinedClassSuffix("SHSSearch");
SHSSearch.setSiteRestriction("short-hair-style.com");
SHSSearch.setRestriction(google.search.Search.RESTRICT_SAFESEARCH, google.search.Search.SAFESEARCH_OFF);
//SHSSearch.setQueryAddition("hair");// to change the result alternative
searchControl.addSearcher(SHSSearch);




// tell the searcher to draw itself in tabbed mode
drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
//searchControl.draw(element, drawOptions);

      searchControl.draw(document.getElementById("searchcontrol"), drawOptions);
      searchControl.setLinkTarget(google.search.Search.LINK_TARGET_PARENT);
      // Execute an inital search if exist
	     if (query){
         searchControl.execute(query);
		 }
		 else{searchControl.execute("new hair styles");}
    }


    google.setOnLoadCallback(OnLoad);

//]]>