var iGlobalFormNumber;

function ShowAjaxTestimonialImage(str1,TargetElement,PageName,iLocation)
{
	//alert(str1+" / "+TargetElement+" / "+PageName);
	
	if (str1.length==0)
	  { 
	  //document.getElementById("IdeaBulb").innerHTML="";
	  document.getElementById(TargetElement).innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	  
	//alert(iLocation);
	//document.getElementById('IdeaBulb').style.top = '600px';
	//alert(document.getElementById('IdeaBulb').style.top.value);
	
	var object = document.getElementById(TargetElement);
	object.style.top = ""+iLocation+"px";
	
	//alert(object.style.top);
	
	var url=PageName;
	url=url+"?id="+str1;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedTestimonialImage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	//var object = document.getElementById('ChatTable');
	//object.style.top = "800px";
}

function stateChangedTestimonialImage() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	//var object = document.getElementById("IdeaBulb");
	//object.style.top = "440px";
	document.getElementById("TestimonialImage").innerHTML=xmlHttp.responseText;
	
	}
} 

function ShowAjaxResult(str1,TargetElement,PageName,iLocation)
{
	//alert(str1+" / "+TargetElement+" / "+PageName);
	
	if (str1.length==0)
	  { 
	  //document.getElementById("IdeaBulb").innerHTML="";
	  document.getElementById(TargetElement).innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	  
	//alert(iLocation);
	//document.getElementById('IdeaBulb').style.top = '600px';
	//alert(document.getElementById('IdeaBulb').style.top.value);
	
	var object = document.getElementById('IdeaBulb');
	object.style.top = ""+iLocation+"px";
	
	//alert(object.style.top);
	
	var url=PageName;
	url=url+"?id="+str1;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	document.getElementById('InfoIntroduction').style.display = 'none';
	document.getElementById('PostitTable').style.display = 'none';
	document.getElementById('WidgetTable').style.display = 'none';
	document.getElementById('QuoteTable').style.display = 'none';
	document.getElementById('ChatTable').style.display = 'none';
	
	//var object = document.getElementById('ChatTable');
	//object.style.top = "800px";
}

function ShowAjaxLearnMore(str1,TargetElement,PageName,iLocation)
{
	//alert(str1+" / "+TargetElement+" / "+PageName);
	
	if (str1.length==0)
	  { 
	  document.getElementById(TargetElement).innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	
	var url=PageName;
	url=url+"?id="+str1;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedLearnMore;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChangedLearnMore() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("AdditionalServices").innerHTML=xmlHttp.responseText;
	}
} 

function ShowAjaxLearnMoreMultiForm(str1,TargetElement,PageName,iLocation,iFormNumber)
{
	//alert(str1+" / "+TargetElement+" / "+PageName);
	iGlobalFormNumber = iFormNumber
	
	if (str1.length==0)
	  { 
	  document.getElementById(TargetElement).innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	
	var url=PageName;
	url=url+"?id="+str1;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedLearnMoreMultiForm;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChangedLearnMoreMultiForm() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("AdditionalServices"+iGlobalFormNumber).innerHTML=xmlHttp.responseText;
	}
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	//var object = document.getElementById("IdeaBulb");
	//object.style.top = "440px";
	document.getElementById("IdeaBulb").innerHTML=xmlHttp.responseText;
	
	}
} 

function showCost(str1,str2,bOrderPage)
{
	if (str1.length==0)
	  { 
	  document.getElementById("CustomCost").innerHTML="";
	  return;
	  }
	if (str2.length==0)
	  { 
	  document.getElementById("CustomCost").innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	  
	if (bOrderPage==1)
	{
		var url="calculator.asp";
	}
	else
	{
		var url="calculator-sizes.asp";
	}
	url=url+"?l="+str1+"&w="+str2;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=costChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	//alert("ding");
	document.getElementById("DummyHolder").style.display = 'none';
	//alert("ding");
	
	if (bOrderPage==1)
	{
		//alert(bOrderPage);
		//document.getElementById("CustomRadioButton").checked=true;
		document.getElementById("EdgePicker").style.display = 'block';
	}
	
	//for (i=0;i<theForm.SizeFrame.length;i++){
	//	If (theForm.SizeFrame[i].value=="CustomSize")
	//	{
	//		theForm.SizeFrame[i].checked=true
	//	}
	//}
}

function showCostStandard(str1,str2,bOrderPage)
{
	//alert("ping");

	if (str1.length==0)
	  { 
	  //document.getElementById("CustomCostStandard").innerHTML="";
	  return;
	  }
	if (str2.length==0)
	  { 
	  //document.getElementById("CustomCostMuseum").innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	  
	//if (bOrderPage==1)
	//{
		var url="/professional/includes/calculator-pro-single.asp";
	//}
	//else
	//{
	//	var url="calculator-sizes.asp";
	//}
	

	
	url=url+"?l="+str1+"&w="+str2;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=costChangedStandard;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	//alert("ding");
	document.getElementById("DummyHolderThin").style.display = 'none';
	document.getElementById("DummyHolderThick").style.display = 'none';
	document.getElementById("DummyHolderChunk").style.display = 'none';
	document.getElementById("DummyHolderStandardFrame").style.display = 'none';
	document.getElementById("DummyHolderFloatingFrame").style.display = 'none';
	//alert("ding2");
	
	
	if (bOrderPage==1)
	{
		//alert(bOrderPage);
		//document.getElementById("CustomRadioButton").checked=true;
	//	document.getElementById("EdgePicker").style.display = 'block';
	}
	
	//for (i=0;i<theForm.SizeFrame.length;i++){
	//	If (theForm.SizeFrame[i].value=="CustomSize")
	//	{
	//		theForm.SizeFrame[i].checked=true
	//	}
	//}
	
	//StartTimer(500,str1,str2,bOrderPage);
	
	//parent.document.getElementById("orderFrame").style.height = 1950;
}

function showCostStandardMultiForm(str1,str2,bOrderPage,iFormNumber)
{
	//alert("ping");

	iGlobalFormNumber = iFormNumber;

	if (str1.length==0)
	  { 
	  //document.getElementById("CustomCostStandard"+iFormNumber).innerHTML="";
	  return;
	  }
	if (str2.length==0)
	  { 
	  //document.getElementById("CustomCostMuseum"+iFormNumber).innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 

	//alert(xmlHttp);
	  
	//var url="calculator-standard-sample.asp";
	var url="/professional/includes/calculator-pro-sample.asp";
	
	url=url+"?l="+str1+"&w="+str2+"&i="+iFormNumber;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=costChangedStandardMultiForm;
	//alert(url);
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	//alert(iFormNumber);
	//document.getElementById("DummyHolderThin"+iFormNumber).style.display = 'none';
	document.getElementById("DummyHolderThin"+iFormNumber).style.display = 'none';
	document.getElementById("DummyHolderThick"+iFormNumber).style.display = 'none';
	document.getElementById("DummyHolderChunk"+iFormNumber).style.display = 'none';
	document.getElementById("DummyHolderStandardFrame"+iFormNumber).style.display = 'none';
	document.getElementById("DummyHolderFloatingFrame"+iFormNumber).style.display = 'none';
	//alert("ding2");
	
	if (bOrderPage==1)
	{
	//	document.getElementById("EdgePicker"+iFormNumber).style.display = 'block';
	}
	
	//StartTimerMultiForm(500,str1,str2,bOrderPage,iFormNumber);
}


function StartTimer(iMilliseconds,str1,str2,bOrderPage)
{
	setTimeout("showCostMuseum("+str1+","+str2+","+bOrderPage+")", iMilliseconds)
}




function showCostMuseum(str1,str2,bOrderPage)
{
	//alert("xing");
	
	if (str1.length==0)
	  { 
	  //document.getElementById("CustomCostStandard").innerHTML="";
	  return;
	  }
	if (str2.length==0)
	  { 
	  //document.getElementById("CustomCostMuseum").innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	  
	var url="calculator-museum.asp";
	url=url+"?l="+str1+"&w="+str2;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=costChangedMuseum;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	//alert("ding");
	document.getElementById("DummyHolderMuseum").style.display = 'none';
	//alert("ding");
	
	if (bOrderPage==1)
	{
		//alert(bOrderPage);
		//document.getElementById("CustomRadioButton").checked=true;
		document.getElementById("EdgePicker").style.display = 'block';
	}
	
	//for (i=0;i<theForm.SizeFrame.length;i++){
	//	If (theForm.SizeFrame[i].value=="CustomSize")
	//	{
	//		theForm.SizeFrame[i].checked=true
	//	}
	//}
}


function showCostMuseumMultiForm(str1,str2,bOrderPage)
{
	iFormNumber = iGlobalFormNumber;

	//alert("showCostMuseumMultiForm");
	
	if (str1.length==0)
	  { 
	  //document.getElementById("CustomCostStandard"+iFormNumber).innerHTML="";
	  return;
	  }
	if (str2.length==0)
	  { 
	  //document.getElementById("CustomCostMuseum"+iFormNumber).innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 

	var url="calculator-museum-sample.asp";
	url=url+"?l="+str1+"&w="+str2+"&i="+iFormNumber;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=costChangedMuseumMultiForm;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	//alert("ding");
	document.getElementById("DummyHolderMuseum"+iFormNumber).style.display = 'none';
	//alert("ding");
	
	if (bOrderPage==1)
	{
		document.getElementById("EdgePicker"+iFormNumber).style.display = 'block';
	}
}

function costChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("CustomCost").innerHTML=xmlHttp.responseText;
	}
} 

function costChangedStandard() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		//try to parse out the response
		//each value is separated by a pipe | character
		//should return 5 values
		var sValues = xmlHttp.responseText.split('|');
		
		//document.getElementById("CustomCostThin").innerHTML=xmlHttp.responseText;
		document.getElementById("CustomCostThin").innerHTML=sValues[0];
		document.getElementById("CustomCostThick").innerHTML=sValues[1];
		document.getElementById("CustomCostChunk").innerHTML=sValues[2];
		document.getElementById("CustomCostStandardFrame").innerHTML=sValues[3];
		document.getElementById("CustomCostFloatingFrame").innerHTML=sValues[4];
	}
} 

function costChangedMuseum() 
{ 
	//alert("m");

	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("CustomCostMuseum").innerHTML=xmlHttp.responseText;
	}
}

function costChangedStandardMultiForm() 
{ 
	//alert("costChangedStandardMultiForm("+iFormNumber+") enter");
	
	//alert(iGlobalFormNumber);

	if (xmlHttp.readyState==4)
	{ 
		//document.getElementById("CustomCostStandard"+iGlobalFormNumber).innerHTML=xmlHttp.responseText;
		var sValues = xmlHttp.responseText.split('|');
		
		//alert(sValues[3]);
		
		//document.getElementById("CustomCostThin").innerHTML=xmlHttp.responseText;
		document.getElementById("CustomCostThin"+iGlobalFormNumber).innerHTML=sValues[0];
		document.getElementById("CustomCostThick"+iGlobalFormNumber).innerHTML=sValues[1];
		document.getElementById("CustomCostChunk"+iGlobalFormNumber).innerHTML=sValues[2];
		document.getElementById("CustomCostStandardFrame"+iGlobalFormNumber).innerHTML=sValues[3];
		document.getElementById("CustomCostFloatingFrame"+iGlobalFormNumber).innerHTML=sValues[4];
	}

	//alert("costChangedStandardMultiForm("+iFormNumber+") exit");
} 

function costChangedMuseumMultiForm() 
{ 
	//alert("costChangedMuseumMultiForm("+iGlobalFormNumber+") enter");

	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("CustomCostMuseum"+iGlobalFormNumber).innerHTML=xmlHttp.responseText;
	}

	//alert("costChangedMuseumMultiForm("+iGlobalFormNumber+") exit");
} 

function ShowAjaxProgressBar(str1)
{
	if (str1.length==0)
	  { 
	  //document.getElementById("IdeaBulb").innerHTML="";
	  document.getElementById("ProgressBar").innerHTML="";
	  return;
	  }
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	
	//alert("BAR");
	
	var url="multiupload/progress.asp";
	url=url+"?uploadID="+str1;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedBar;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChangedBar() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("ProgressBar").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;
}

