// Print web page
function printpage() {
	window.print(); 
	return false;
}

function changeurl(newid) {

	begining = String(window.location).slice(0,String(window.location).indexOf('?'));
	query = window.location.search;

	nowa = query.replace(query.slice(query.indexOf('=')+1,query.indexOf('&')),newid);
	
	window.location = String(begining)+String(nowa);
	return false;
}


function checkSearchFields(objForm)
{	
		if(objForm.keywords.value == "") {
			alert("Please enter your keyword(s)");
			objForm.keywords.focus();
			return false;
		}
		else {
			return true;
		}
}


function swapPhoto(passedid,passedpos,positionstring,descriptionstring,secondimage) {
	
positarray=new Array(30);

positarray[1]="Front View";
positarray[2]="Back View";
positarray[3]="Back panel, inside; neck area ";
positarray[4]="Left-hand side chest, front of the shirt";
positarray[5]="Attached to the right hand side collar tape";
positarray[6]="Right hand side, bottom inside of the shirt, stitch between panels";
positarray[7]="Left / Right armpit";
positarray[8]="Stich between back panel and collar tape, Left - Hand side, inside of the shirt ";
positarray[9]="Left / Right outer sleeve";
positarray[10]="Availabe";
positarray[11]="Available";



/*	document.getElementById("piccount" + passedid).firstChild.firstChild.src = "" + secondimage;*/

	document.getElementById("piccount" + passedid).style.background = "center url(" + secondimage +")";
	
	
if (document.getElementById("mini")) {

 if( isNaN( parseInt(passedpos,10))) {
	   document.getElementById("mini").firstChild.src = "cat_images/pos0.jpg";
	  }
	  else {
  		document.getElementById("mini").firstChild.src = "cat_images/pos" + parseInt(passedpos) + ".jpg";
	  }
}



  if( isNaN( parseInt(positionstring,10))) {
	   document.getElementById("posit").innerHTML=""+positionstring; 
	  }
	  else {
  		document.getElementById("posit").innerHTML=""+positarray [parseInt(passedpos,10)]; 
	  }
	
	document.getElementById("desc").innerHTML=""+descriptionstring; 
	
	
    /*scrollTo(0,265);*/
	
}


// Show / Hide Script
function show(c) { 
	if (document.getElementById && document.getElementById(c)!= null) 
		node = document.getElementById(c).style.display=''; 
	else if (document.layers && document.layers[c]!= null) 
		document.layers[c].display = ''; 
	else if (document.all && document.all(c)!= null) 
		document.all[c].style.display = ''; 
} 

function hide(c) {	
	if (document.getElementById && document.getElementById(c)!= null)
		node = document.getElementById(c).style.display='none';
	else if (document.layers && document.layers[c]!= null) 
		document.layers[c].display = 'none';
	else if (document.all && document.all(c)!= null) 
		document.all[c].style.display = 'none';
}

/*** keep alive ***/
var gsDomain = window.location.protocol + "//" + window.location.host;
var gfUsingIP = (((window.location.host.substring(0, 1) >= "0") && (window.location.host.substring(0, 1) <= "9")) || (window.location.host == "localhost"));
var gsFolder = "/";
if(gfUsingIP) {
	gsFolder = "/" + window.location.pathname.substring(1, window.location.pathname.indexOf("/", 1)) + "/";
}
gsDomain += gsFolder;
document.write("<script type=\"text/javascript\" src=\"/assets/scripts/EdeptiveAjax.js\"></script>");
var goAjax = null;
function keepAlive() {
	var strUrl = "";
	var sTiming = document.documentElement.lastChild.lastChild.innerHTML;
	var sParams = "";

	sTiming = sTiming.substring(sTiming.lastIndexOf("<!--"));
	sTiming = sTiming.substring(5, sTiming.length - 4);
	strUrl = gsDomain + "/webservices/keep_alive.asmx/Ping";
	sParams = "Timing=" + sTiming;
	try {
		goAjax = new EdeptiveAjax();
		goAjax.postRequest(strUrl, sParams, onKeepAliveResponse);
	} catch(e) {
		setTimeout("keepAlive()", 1000*1);
	}
}
function onKeepAliveResponse() {
	if(goAjax.checkReadyState("keepAlive", "ping.", "ping..", "ping...") == "OK") {
		if(document.getElementById("keepAlive")) {
			var response = goAjax.request.responseXML.documentElement;
			document.getElementById("keepAlive").innerText = "sid=" + getText(response.firstChild);
		}
		setTimeout("keepAlive()", 1000*60);
	}
}
setTimeout("keepAlive()", 1000*2);
