// JavaScript Document
var xmlHttp
function getsoftwareprices(str){
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	var url="/dir123789/scripts/cms/pg_api.php"

	var params = "masterid="+str;
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("POST", url, true);
	//Send the proper header information along with the request
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(params);
}

function stateChanged(){
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
 	document.getElementById("pg_price").innerHTML=xmlHttp.responseText
 }
}

function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
 		// Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
 	}
	catch (e){
 		// Internet Explorer
 	try{
  		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  	}
 	catch (e){
  		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
 }
	return xmlHttp;
}

var xmlHttp_alt
function getsoftwareprices_alt(str){
	xmlHttp_alt=GetXmlHttpObject_alt()
	if (xmlHttp_alt==null){
	 alert ("Browser does not support HTTP Request")
	 return
	} 
	var url="/dir123789/scripts/cms/pg_api.php"
	var params = "masterid="+str;
	xmlHttp_alt.onreadystatechange=stateChanged_alt
	xmlHttp_alt.open("POST", url, true);
	//Send the proper header information along with the request
	xmlHttp_alt.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp_alt.setRequestHeader("Content-length", params.length);
	xmlHttp_alt.setRequestHeader("Connection", "close");
	xmlHttp_alt.send(params);
}

function stateChanged_alt(){ 
 if (xmlHttp_alt.readyState==4 || xmlHttp_alt.readyState=="complete"){ 
 	document.getElementById("txtHint_alt").innerHTML=xmlHttp_alt.responseText 
 } 
}

function GetXmlHttpObject_alt(){
	var xmlHttp_alt=null;
	try{
 		// Firefox, Opera 8.0+, Safari
 		xmlHttp_alt=new XMLHttpRequest();
 	}
	catch (e){
 		// Internet Explorer
 	try{
  		xmlHttp_alt=new ActiveXObject("Msxml2.XMLHTTP");
  	}
 	catch (e){
  		xmlHttp_alt=new ActiveXObject("Microsoft.XMLHTTP");
  	}
 }
	return xmlHttp_alt;
}


var xmlHttp2

function upsalebar(str,category)
{
	if(category == null) {
		category=0;
	}
xmlHttp2=GetXmlHttpObject2()
if (xmlHttp2==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/dir123789/scripts/cms/cross_sale_bar.php"

url=url+"?q="+str
url=url+"&sid="+Math.random()
url=url+"&cat="+category
xmlHttp2.onreadystatechange=stateChanged2
xmlHttp2.open("GET",url,true)
xmlHttp2.send(null)
}

function stateChanged2()
{
 if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
 {

 document.getElementById("upsalearea").innerHTML=xmlHttp2.responseText
 }
}

function GetXmlHttpObject2()
{
var xmlHttp2=null;

try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp2=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp2;
}


function getsoftcompareprices(str2){
	xmlHttp3=GetXmlHttpObject3()
	if (xmlHttp3==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	var url2="/dir123789/scripts/cms/pg_api.php"

    var params2 = "masterid="+str2;
	xmlHttp3.onreadystatechange=stateChanged3
	xmlHttp3.open("POST", url2, true);
	//Send the proper header information along with the request
	xmlHttp3.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp3.setRequestHeader("Content-length", params2.length);
	xmlHttp3.setRequestHeader("Connection", "close");
	xmlHttp3.send(params2);
}

function stateChanged3(){
 if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete"){
 	document.getElementById("pricegrabberreplace").innerHTML=xmlHttp3.responseText
 }
}

function GetXmlHttpObject3(){
	var xmlHttp3=null;
	try{
 		// Firefox, Opera 8.0+, Safari
 		xmlHttp3=new XMLHttpRequest();
 	}
	catch (e){
 		// Internet Explorer
 	try{
  		xmlHttp3=new ActiveXObject("Msxml2.XMLHTTP");
  	}
 	catch (e){
  		xmlHttp3=new ActiveXObject("Microsoft.XMLHTTP");
  	}
 }
	return xmlHttp3;
}


function hidediv() {
	if (document.getElementById) { // DOM3 = IE5, NS6
	document.getElementById('hideShow').style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
		document.hideShow.display = 'none';
		}
		else { // IE 4
		document.all.hideShow.style.display = 'none';
		}
	}
}


function showdiv(e) {
	var scrOfX = 0, scrOfY = 0;
	  if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	  }

	  if (document.layers){
		xCoord = e.x;
		yCoord = e.y;
	  }
	  else if (document.getElementById){
		xCoord = e.clientX;
		yCoord = e.clientY;
	  }
	  else if (document.all){
		xCoord = event.clientX;
		yCoord = event.clientY;
	  }
	  xCoord = xCoord + scrOfX;
	  yCoord = yCoord + scrOfY;

	  document.getElementById('hideShow').style.visibility = 'visible';
	  document.getElementById('hideShow').style.left = xCoord+'px';
	  document.getElementById('hideShow').style.top = yCoord+'px';
}

function show_shortdef(index, name) {
        var desc = short_defs[index] || "Definition not available";
        document.getElementById("txtHint").innerHTML =
'        <div class="close_container">' +
'            <div class="pg_prod_name">' + name + '</div>' +
'            <div class="pg_img_close"><a href="javascript:hidediv()">' +
'                <img src="http://toptenreviews.com/i/pg_images/div_close_button.gif" /></a>' +
'            </div></div>' +
'        <div class="pricegrabber_legend_matrix"><div style="float: right; width: 233px;">' + desc + '</div></div>';
}
