// JavaScript Document
//Create Microsoft.XMLHTTP Object
function makeObject(){
var request = false;
if (window.XMLHttpRequest) {
	if (typeof XMLHttpRequest != 'undefined')
		try {
			request = new XMLHttpRequest();
			} catch(e) {
				request = false;
			}
		} else if (window.ActiveXObject) {
			try {
				request = new ActiveXObject('Msxml2.XMLHTTP');
				} catch(e) {
					try {
						request = new ActiveXObject('Microsoft.XMLHTTP');
					} catch(e) {
							request = false;
					}
				}
			}
		return request;
}	
 
function createXMLHttpRequest() {
  try { return new XMLHttpRequest(); } catch(e) {}
  try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
  alert("XMLHttpRequest not supported");
  return null;
}

//call the function makeObject()
var request = makeObject();
var requestb = createXMLHttpRequest();
var thed;	   
var starttime;
var endtime;
var timetime;
var fadein;
var thetype;
var therequest;
var loadingid;

function CallGoogleAPI(page,vars){
	starttime = new Date().getTime();
	//document.getElementById('timer').innerHTML="";
	
	requestb.abort();
	alert(page);
	requestb.open('POST', page);
	requestb.onreadystatechange = GetGoogleResponse; 
	//Send the proper header information along with the request
	var params;
	alert(vars);
	parms = vars;
	//params = params.replace("%","");
	//alert(params);
	requestb.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//requestb.setRequestHeader("Content-length", params.length);
	//requestb.setRequestHeader("Connection", "close");
	requestb.send(params);
}
function GetGoogleResponse(){
	if(requestb.readyState == 4){ 
		//hidediv('loading');
		var answer = requestb.responseText;
		//document.getElementById(loadingid).innerHTML="";
		//changeOpac(0, 'boxes', 'out');
		alert(answer.length);
		document.getElementById('google').innerHTML = '[' + answer + ']';
		endtime = new Date().getTime();
		timetime = (endtime - starttime) * 0.001;
		document.getElementById('timer').innerHTML = '<span style="font-size:x-small">Execution time: ' + timetime.toFixed(3) + ' seconds</span>';
	}
}

function loadajaxdb(element,thesearch,perpage,sortby,page){
	loadingid = element;
	therequest = thesearch;
	starttime = new Date().getTime();
	document.getElementById('timer').innerHTML="";
	document.getElementById('boxes').innerHTML="<img src='/images/ajax-loading-bar.gif' />&nbsp;<img src='/images/loading-short.gif' />&nbsp;Searching...";
	fadein = false;
	//alert(u);
	if (thesearch.indexOf("&searchtype=catsearch") != -1 || thesearch.indexOf("&searchtype=allsearch") != -1){
	 var se = thesearch;
	 se = se.replace("searcher=","");
	 se = se.replace("&searching=true","");
	 //alert(se);
	 if (thesearch.indexOf("&searchtype=catsearch") != -1)
		 writetofile('searchpage',"B[" + se + "]");
	 if (thesearch.indexOf("&searchtype=allsearch") != -1)
		 writetofile('searchpage',"F[" + se + "]");
	 //alert("ok search");
	}
	//nd();
	//opacity('boxes', 100, 0, 3);
	//changeOpac(0, 'boxes', 'out');

	if (perpage == "")
	{
	 perpage = getaCookie('perpage');
	}
	else
	{
	 setCookie('perpage',perpage,'1');
	}
	thesearch = thesearch + '&perpage=' + perpage;
 
	if (sortby == "")
	{
	 sortby = getaCookie('sortby');
	}
	else
	{
	 setCookie('sortby',sortby,'1');
	}
	thesearch = thesearch + '&sortby=' + sortby;
	if (page == "")
	{
	 page = getaCookie('currentpagen');
	}
	else
	{
	setCookie('currentpagen',page,'1');
	}
	thesearch = thesearch + '&page=' + page;
	
	requestb.abort();
	
	//requestb = makeObject();
	
	requestb.open('POST', 'show_boxes_db.php');
	requestb.onreadystatechange = parselist; 
	//Send the proper header information along with the request
	var params = thesearch + '&screenwidth=' + screen.width;
	params = params.replace("%","");
	//alert(params);
	requestb.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	requestb.setRequestHeader("Content-length", params.length);
	requestb.setRequestHeader("Connection", "close");

	requestb.send(params);
	alertTimerId = setTimeout ( "shortwait()", 2000 )
}

function loadajax(element,thesearch,perpage,sortby,page){
	loadingid = element;
	therequest = thesearch;
 
	//alert(thesearch);
	//alert(page);
 
	starttime = new Date().getTime();
	document.getElementById('timer').innerHTML="";
	document.getElementById('boxes').innerHTML="<img src='/images/ajax-loading-bar.gif' />&nbsp;<img src='/images/loading-short.gif' />&nbsp;Searching...";
	fadein = false;
	//alert(u);
	if (thesearch.indexOf("&searching") != -1){
	 //alert('search');
	 //var se = getaCookie('search'); //document.showboxes.perpage.value;
	 var se = thesearch;
	 se = se.replace("searcher=","");
	 se = se.replace("&searching=true","");
	 //alert(se);
	 if (thesearch.indexOf("&doitemsearch=false") != -1)
	 writetofile('searchpage',"B[" + se + "]");
	 else
	 writetofile('searchpage',"F[" + se + "]");
	 //alert("ok search");
	}
	nd();
	//opacity('boxes', 100, 0, 3);
	//changeOpac(0, 'boxes', 'out');

	if (perpage == "")
	{
	 perpage = getaCookie('perpage');
	}
	else
	{
	 setCookie('perpage',perpage,'1');
	}
	thesearch = thesearch + '&num=' + perpage;
 
	if (sortby == "")
	{
	 sortby = getaCookie('sortby');
	}
	else
	{
	 setCookie('sortby',sortby,'1');
	}
	thesearch = thesearch + '&sortby=' + sortby;
	if (page == "")
	{
	 page = getaCookie('currentpagen');
	}
	else
	{
  setCookie('currentpagen',page,'1');
	}
	thesearch = thesearch + '&page=' + page;
 
 	request.abort();
	request.open('POST', 'show_boxes.php');
	request.onreadystatechange = parselist; 
	//Send the proper header information along with the request
	var params = thesearch + '&screenwidth=' + screen.width;
	params = params.replace("%","");
	request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	request.setRequestHeader("Content-length", params.length);
	request.setRequestHeader("Connection", "close");

	request.send(params);
	alertTimerId = setTimeout ( "shortwait()", 2000 )
}

function loaditem(i){
starttime = new Date().getTime();
requestb.abort();
requestb.open('get', 'show_detail.php?item=' + i);
requestb.onreadystatechange = parselist; 
requestb.send('');
}

function parselist(){
	if(requestb.readyState == 4){ 
		//hidediv('loading');
		var answer = requestb.responseText;
		//document.getElementById(loadingid).innerHTML="";
		//changeOpac(0, 'boxes', 'out');
		opacity('boxes', 100, 0, 3);
		changeOpac(0, 'boxes', 'out');
		//alert(answer.length);
		document.getElementById('boxes').innerHTML = answer;
		clearTimeout ( alertTimerId );
		endtime = new Date().getTime();
		timetime = (endtime - starttime) * 0.001;
		document.getElementById('timer').innerHTML = '<span style="font-size:x-small">Execution time: ' + timetime.toFixed(3) + ' seconds</span>';
		writetofile('ajaxtime',timetime.toFixed(3) + " seconds for " + escape(therequest));
		//writetofile('searchpage',"[" + se + "]");
		//if (document.getElementById("loader")) {
		//  document.getElementById("loader").innerHTML = "";
		//}
		fadein = true;
		opacity('boxes', 1, 100, 3000);
		//document.getElementById('searchideas').focus();
		//document.getElementById('sitesearch').focus();
		//window.scroll(0,0);
	}
}

function shortwait(){
	document.getElementById('boxes').innerHTML = "<img src='/images/ajax-loading-bar.gif' />&nbsp;<img src='/images/loading-medium.gif' />&nbsp;Searching, Just a moment longer...";
	alertTimerId = setTimeout ( "longwait()", 3000 )
}
function longwait(){
	document.getElementById('boxes').innerHTML = "<img src='/images/ajax-loading-bar.gif' />&nbsp;<img src='/images/loading-long.gif' />&nbsp;Searching, Just a moment longer...<br><br>Well, this is embarassing.<br><br>We apologize, this search is taking longer than normal.<br>You should have had a response by now!<br><br>I am still trying, but this should not happen every time!";
}

var browserType;
if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
   browserType= "gecko"
}

function hidediv(d) {
  counttime=0;
  if (browserType == "gecko" )
	 document.poppedLayer =
		 eval('document.getElementById(d)');
  else if (browserType == "ie")
	 document.poppedLayer =
		eval('document.getElementById(d)');
  else
	 document.poppedLayer =  
		eval('document.layers[d]');
  document.poppedLayer.style.visibility = "hidden";
}

function showdiv(d) {
  counttime=0;
  if (browserType == "gecko" )
	 document.poppedLayer =
		 eval('document.getElementById(d)');
  else if (browserType == "ie")
	 document.poppedLayer =
		eval('document.getElementById(d)');
  else
	 document.poppedLayer =
		 eval('document.layers[d]');
  document.poppedLayer.style.visibility = "visible";
}

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
	 for(i = opacStart; i >= opacEnd; i=i-5) {
	 setTimeout("changeOpac(" + i + ",'" + id + "','out')",(timer * (speed * 2)));
	 timer++;
	 }
	} else if(opacStart < opacEnd) {
	 for(i = opacStart; i <= opacEnd; i=i+5)
	 {
	 setTimeout("changeOpac(" + i + ",'" + id + "','in')",(timer * (speed * 2)));
	 timer++;
	 }
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id, d) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
	 opacity(id, 0, 100, millisec);
	} else {
	 opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
 
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
 
	//make image transparent
	changeOpac(0, imageid);
 
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
	 setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
	 timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
 
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
	 currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}

function gototop(){
	//alert('going top');
	window.location = "#thetop";
}

function gotopagedrop(chosen){
	window.location=chosen;
}
function getmedia(m){
	//alert(m);
	if(m == "Choose Here"){
  document.getElementById('mediatext').innerHTML = "Choose your presentation above";
  document.getElementById('mediadiv').innerHTML = '';
	}
	if(m == "ironman1"){
  document.getElementById('mediatext').innerHTML = "This manufacturers video shows the strength of the Ironman series of paint sprayers.<br>(Please don't try this at home)";
  document.getElementById('mediadiv').innerHTML = '<object width="660" height="405"><param name="movie" value="http://www.youtube-nocookie.com/v/qPUjmRnKCJg&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/qPUjmRnKCJg&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="405"></embed></object>';
	}
	if(m == "linedriver2"){
  document.getElementById('mediatext').innerHTML = "This manufacturers video shows the Graco LineDriver HD Ride-On Striping Machine";
  document.getElementById('mediadiv').innerHTML = '<object width="500" height="405"><param name="movie" value="http://www.youtube-nocookie.com/v/IsTdWDQ93pk&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/IsTdWDQ93pk&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="405"></embed></object>';
	}
	if(m == "magnum"){
  document.getElementById('mediatext').innerHTML = "";
  document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/mfHJDsGNZ7A&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/mfHJDsGNZ7A&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "gracoinstr"){
  document.getElementById('mediatext').innerHTML = "";
  document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/Pdc7e-Sb8z8&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Pdc7e-Sb8z8&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "gracocleanup"){
  document.getElementById('mediatext').innerHTML = "";
  document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/5wnHchngO8Q&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/5wnHchngO8Q&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "gracoaccess"){
  document.getElementById('mediatext').innerHTML = "";
  document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/bNEsJETJaxU&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/bNEsJETJaxU&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "gracohowtospray"){
  document.getElementById('mediatext').innerHTML = "";
  document.getElementById('mediadiv').innerHTML = '<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/TuqZJbo6Q-w&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/TuqZJbo6Q-w&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object>';
	}
	if(m == "695misc"){
  document.getElementById('mediatext').innerHTML = "";
  document.getElementById('mediadiv').innerHTML = '<object width="580" height="360"><param name="movie" value="http://www.youtube.com/v/6EdD8uEe_BQ&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/6EdD8uEe_BQ&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"></embed></object>';
	}
	if(m == "695misc2"){
  document.getElementById('mediatext').innerHTML = "";
  document.getElementById('mediadiv').innerHTML = '<object width="580" height="360"><param name="movie" value="http://www.youtube.com/v/foD86cb801c&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/foD86cb801c&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"></embed></object>';
	}
	if(m == "695instr"){
  document.getElementById('mediatext').innerHTML = "";
  document.getElementById('mediadiv').innerHTML = '<object width="580" height="360"><param name="movie" value="http://www.youtube.com/v/TEUJvgQnGkY&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/TEUJvgQnGkY&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="360"></embed></object>';
	}
	if(m == "convenital"){
  document.getElementById('mediatext').innerHTML = "";
  document.getElementById('mediadiv').innerHTML = '<object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/91ieuwSsv9M&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/91ieuwSsv9M&hl=en&fs=1" type="application/x-shockwave-flash" width="480" height="295" allowscriptaccess="always" allowfullscreen="true"></embed></object>';
	}
	if(m == "whisperwash"){
  document.getElementById('mediatext').innerHTML = "WhisperWash's initial commitment to quality is displayed in the superior engineering of the Whisper Wash® Classic. Additionally they offer you the added benefits of cleaning large flat surface areas with The Big Guy, Ground Force Flip-N-Fold, and the Aqua Pro, or the flexibility in design choices provided by the Lil' Guy or our Ultra Clean line. Whisper Wash® pressure washing systems provide proven economical benefits to industrial pressure cleaning users throughout the world.";
  document.getElementById('mediadiv').innerHTML = '<object id="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows® Media Player components..." type="application/x-oleobject" width="280" height="256"><param name="fileName" value="media/whisperwash.avi"><param name="animationatStart" value="true"><param name="transparentatStart" value="true"><param name="autoStart" value="true"><param name="showControls" value="true"><param name="Volume" value="-450"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="media/whisperwash.avi" name="MediaPlayer1" width=280 height=256 autostart=1 showcontrols=1 volume=-450></object>';
	}
}

function writetofile(p,t){
//alert('writefile.php?page=' + p + '&txt=' + t);
requestb.open('get', 'writefile.php?page=' + p + '&txt=' + t);
requestb.onreadystatechange = writeresult; 
requestb.send('');
}

function writeresult(){
if(requestb.readyState == 4){ 
//hidediv('loading');
	var answer = requestb.responseText;
	//alert(answer);
	}
}

function getaCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
	{
	c_start=c_start + c_name.length+1;
	c_end=document.cookie.indexOf(";",c_start);
	if (c_end==-1) c_end=document.cookie.length;
	return unescape(document.cookie.substring(c_start,c_end));
	}
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

var IE = document.all?true:false;
//if (!IE) document.captureEvents(Event.MOUSEMOVE)
//document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY() {
  alert("setting scroll " + window.scrollY);
  setCookie('scroll',window.scrollY,'1');
}
function getScrollXY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
	//Netscape compliant
	scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	//DOM compliant
	scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	//IE6 standards compliant mode
	scrOfY = document.documentElement.scrollTop;
  }
  //alert("setting scroll " + scrOfY);
  setCookie('scroll',scrOfY,'1');
}
function setScrollXY(scrOfY) {
  if( typeof( window.pageYOffset ) == 'number' ) {
	//Netscape compliant
	window.pageYOffset = scrOfY;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	//DOM compliant
	document.body.scrollTop = scrOfY;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	//IE6 standards compliant mode
	document.documentElement.scrollTop = scrOfY;
  }
}
function googlecartAfterAdd(item, index){
	writetofile('addtocart','Add ' + item.getQuantity() + ' ' + item.getTitle() + '=$' + googlecart.getSubtotal());
}
function googlecartAfterRemove(item, index){
	writetofile('addtocart','Remove ' + item.getQuantity() + ' ' + item.getTitle() + '=$' + googlecart.getSubtotal());
}
function googlecartOnCheckoutClick(items, form) {
	writetofile('addtocart','CHECKOUT ' + googlecart.getTotalQuantity() + ' items and ' + googlecart.getItems().length + ' unique =$' + googlecart.getSubtotal());
	return true;
}
function googlecartBeforeAdd(item, index, newQuantity, opt_node){
	if (item.getTitle() == undefined){
	 writetofile('addtocart','ERROR ' + item.getQuantity() + ' ' + item.getTitle() + '=$' + googlecart.getSubtotal());
	 alert('Sorry, an error occured and this item can not be added to the shopping cart.\nThe web-browser you are using is not fully supported by Google Checkout.\nPlease try a different web-browser.');
	 return false;
	}
	else
	{
	 return true;
	}
}
//Called before a new product is added or quantity of a product is increased. Can be triggered by add-to-cart button, adding a product programmatically, increasing quantity in the cart itself.
//The item is added to the shopping cart only if this function returns true.
//@param {ShoppingCartItem} item - object representing the item to be added to the shopping cart. If you need to modify the item - do this on this object.
//You can modify the price on this item, it will be applied to the identical products already in the cart.
//@param {number} index - index of the existing product in the cart that will be affected or null if the product is new and not yet in the cart
//@param {number} newQuantity - quantity that will be in the cart if adding is successful.
//@param {Node} opt_node - HTML DOM node, optional, when available represents the product to be added.
//@return {boolean} - when true the item is added to the cart.
function hidealllong(thelong) {
	i = 1;
	do 
		{
	   		thisDiv = document.getElementById('l'+i);
			thisDiv.style.display = "none";
			i++
			thatDiv = document.getElementById('l'+i);
		}
	while (thatDiv)
	if (thelong=='true') {
	thisDiv = document.getElementById('l1');
	thisDiv.style.display = "block";
	}
}
function showalllong() {
	i = 1;
	thisDiv = document.getElementById('l'+i);
	do 
		{
	   		thisDiv = document.getElementById('l'+i);
			thisDiv.style.display = "block";
			i++
			thisDiv = document.getElementById('l'+i);
		}
	while (thisDiv)
}
function toggle(divName) {
	var thisDi = document.getElementById(divName);
	//alert(thisDi.id);
	if (thisDi) {
		//alert(thisDi.id);
		if (thisDi.style.display == "none") {
			hidealllong(false);
			thisDi.style.display = "block";
		}
		else {
			//alert(thisDi.id);
			thisDi.style.display = "none";
		}
	}
//	return false;
}
function popitup(url)
{
	newwindow=window.open(url,'name','top=200,left=400,height=400,width=500,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function popWinUp(URL)
{
	//child = window.open(URL, "spawn", "height=450,width=650,menubar=yes,resizable=yes,status=yes,scrollbars=yes,toolbar=yes,location=yes");
	child = window.open(URL, "spawn", "");
	child.opener = self;
	child.focus();
}
function revertsearch(searchnow){
	loadajaxdb("timer","searchtype=boxes&search=" + searchnow, getaCookie('perpage'), getaCookie('sortby'), getaCookie('currentpagen'));
}


function DoBGColor(fld, c) 
{
	//alert(c);
    switch(c){
		case 'blue':
			fld.style.background ='#66FFFF';
			break;
		case 'yellow':
			fld.style.background ='#FFFFCC';
			break;
		case 'green':
			fld.style.background ='#80FF80';
			break;
		case 'red':
			fld.style.background ='#FFB9B9';
	}
}
