// JavaScript Document
var path = "http://www.getfoundlocal.com/";
//getParam
function getParams() {
  var idx = document.URL.indexOf('?');
  var params = new Array();
  if (idx > 0) {
     var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
     for (var i=0; i<pairs.length; i++) {
         nameVal = pairs[i].split('=');
		 nameVal_new = ReplaceAll(nameVal[1],'+',' ')
         params[nameVal[0]] = nameVal_new;
     }

  }

  return params;

}
function ReplaceAll(Source,stringToFind,stringToReplace){
  var temp = Source;
    var index = temp.indexOf(stringToFind);
        while(index != -1){
            temp = temp.replace(stringToFind,stringToReplace);
            index = temp.indexOf(stringToFind);
        }
        return temp;
}

params = getParams();
searchQuery = decodeURI(params["text_searchkey"]);
zipCode = unescape(params["zip"]);
zipcode1 =params["zip"];
total_count_v=unescape(params["total_count"]);
premium_store_count_v=unescape(params["premium_store_count"]);
currentPage_v=unescape(params["currentPage"]);
durl_v=escape(window.document.location.toString());
//var path = "http://www.demo.veblogy.com/getfound/";
var imgpath = path+"toolbar";
if (searchQuery == 'undefined' || searchQuery == '')
{
	searchQuery='';
}if (zipCode == 'undefined' || zipCode == ''){
	zipCode = '';
}

function callapi()
{
	var query = document.getElementById('text_searchkey').value
	var zip = document.getElementById('zip').value
	var postStr = "search="+query+"&zip="+zip;
	//document.getElementsByTagName('body')[0].innerHTML = '';
//	document.getElementById('showresults').innerHTML = '<style type="text/css">html, body, div, iframe { margin:0; padding:0; height:100%; }   iframe { display:block; width:100%; border:none; } </style>'+'<div id="showresult"><iframe id="glu" src="'+path+'apiresponse1.php?'+postStr+'" width="100%" style="overflow:scroll; min-height:100%;" frameborder="0" scrolling="no"></iframe></div>';
	return false;
}



document.write('<table cellspacing="0" cellpadding="0" border="0"  ><tbody><tr><td style="background:url('+imgpath+'/topBorder_left.gif) no-repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 18px; height: 10px;"><img border="0" src="'+imgpath+'/spacer.gif"/></td>');

document.write('<td style="background: #FFFFFF url('+imgpath+'/topBorder_center.gif) repeat-x scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; height: 18px;"><img border="0" src="'+imgpath+'/spacer.gif"/></td>');

document.write('<td style="background: url('+imgpath+'/topBorder_right.gif) no-repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 18px; height: 18px;"><img border="0" src="'+imgpath+'/spacer.gif"/></td>');

document.write('</tr><tr><td style="background: #FFFFFF url('+imgpath+'/left_border.gif) repeat-y scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 18px;"></td>');

document.write('<td><table cellspacing="2" cellpadding="0" border="0" style="font-family: Arial,Helvetica,sans-serif; font-size: 13px; background-color:#FFFFFF;"><form method="get" action="?" name="form1" />');

document.write('<tbody><tr><td>Enter Business Name</td><td>City,State <b>OR</b> Zip Code</td><td></td></tr><tr><td><input type="text" maxlength="100" size="35" name="text_searchkey" id="text_searchkey" value="'+searchQuery+'"/></td>');

document.write('<td><input type="text" name="zip" id="zip" value="'+zipCode+'"></td><td><input type="submit" style="border: 1px solid rgb(153, 153, 153); background-image: url(toolbar/search_btn_bg.jpg); width: 160px; font-weight: bold; color: rgb(34, 34, 34); font-size: 13px;" value="Search" name="submit" /></td>');

document.write('</tr><tr><td style="font-size: 11px; color: rgb(102, 102, 102);" colspan="3"></td></tr></tbody></form></table></td>');

document.write('<td style="background: #FFFFFF url('+imgpath+'/right_border.gif) repeat-y scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 18px;"></td>');

document.write('</tr><tr><td valign="top" style="background:transparent url('+imgpath+'/bottom_left.gif) no-repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 18px;"></td>');

document.write('<td style="background: transparent url('+imgpath+'/bottom_center.gif) repeat-x scroll 0%; -moz-background-clip: -moz-initial; height:18px; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; "></td>');

document.write('<td valign="top" style="background: transparent url('+imgpath+'/bottom_right.gif) no-repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 18px;"></td></tr></tbody></table>');