// JavaScript Document
function GetXmlHttpObject(handler)
{
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}

function htmlData(url,qstring,div)
{
if (url.length==0)
{
document.getElementById(div).innerHTML="";
return;
}

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}

xmlHttp.onreadystatechange = function()
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			if(document.getElementById(div))
			document.getElementById(div).innerHTML=xmlHttp.responseText;			
		}
		else
		{ 
			if(document.getElementById(div))
			document.getElementById(div).innerHTML="<img src='images/loading.gif'   border=0>";
		}
}
if(qstring!='')
url=url+qstring;
xmlHttp.open("GET",url,true) ;
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=ISO-8859-1");
xmlHttp.send(null);
}



function htmlData2(url,qstring,div)
{
if (url.length==0)
{
document.getElementById(div).innerHTML="";
return;
}
xmlHttp2=GetXmlHttpObject()
if (xmlHttp2==null)
{
alert ("Browser does not support HTTP Request");
return;
}
xmlHttp2.onreadystatechange = function()
{
		if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
		{ 
			if(document.getElementById(div))
			document.getElementById(div).innerHTML=xmlHttp2.responseText;

			/*jQuery(document).ready(function($) 
	{
  		$('a[rel*=facebox]').facebox() 
	})*/ 
		}
		else
		{ 
			if(document.getElementById(div))	
			  document.getElementById(div).innerHTML="<img src='images/loading.gif'   border=0>";
		}
}

if(qstring!='')
url=url+"&"+qstring;
xmlHttp2.open("POST",url,true) ;
xmlHttp2.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=ISO-8859-1");
xmlHttp2.send(null);
}


function htmlDataPackageDD(url,qstring,div)
{
if (url.length==0)
{
document.getElementById(div).innerHTML="";
return;
}
xmlHttp3=GetXmlHttpObject()
if (xmlHttp3==null)
{
alert ("Browser does not support HTTP Request");
return;
}
xmlHttp3.onreadystatechange = function()
{
		if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete")
		{ 
			if(document.getElementById(div))
			document.getElementById(div).innerHTML=xmlHttp3.responseText;

		}
		else
		{ 
			if(document.getElementById(div))
				document.getElementById(div).innerHTML="<img src='images/loading.gif'   border=0>";
		}
}

if(qstring!='')
url=url+qstring;

xmlHttp3.open("POST",url,true) ;
xmlHttp3.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=ISO-8859-1");
xmlHttp3.send(null);
}

function htmlDataShipping(url,qstring,div)
{
if (url.length==0)
{
document.getElementById(div).innerHTML="";
return;
}
xmlHttp4=GetXmlHttpObject()
if (xmlHttp4==null)
{
alert ("Browser does not support HTTP Request");
return;
}
xmlHttp4.onreadystatechange = function()
{
		if (xmlHttp4.readyState==4 || xmlHttp4.readyState=="complete")
		{ 
			if(document.getElementById(div))
			document.getElementById(div).innerHTML=xmlHttp4.responseText;

		}
		else
		{ 
			if(document.getElementById(div))
				document.getElementById(div).innerHTML="<img src='images/loading.gif'   border=0>";
		}
}

if(qstring!='')
url=url+qstring;

xmlHttp4.open("POST",url,true) ;
xmlHttp4.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=ISO-8859-1");
xmlHttp4.send(null);
}

function htmlDataReview(url,qstring,div)
{
if (url.length==0)
{
document.getElementById(div).innerHTML="";
return;
}

xmlHttpRev=GetXmlHttpObject()
if (xmlHttpRev==null)
{
alert ("Browser does not support HTTP Request");
return;
}

xmlHttpRev.onreadystatechange = function()
{
		if (xmlHttpRev.readyState==4 || xmlHttpRev.readyState=="complete")
		{ 
			document.getElementById(div).innerHTML=xmlHttpRev.responseText;
			
		}
		else
		{ 
			if(document.getElementById(div))
				document.getElementById(div).innerHTML="<img src='images/loading.gif'   border=0>";
		}
}
if(qstring!='')
url=url+qstring;
xmlHttpRev.open("GET",url,true) ;
xmlHttpRev.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=ISO-8859-1");
xmlHttpRev.send(null);
}
   

function makePOSTRequest(url, parameters,div) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
                  http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = function()
		{
			if (http_request.readyState == 4) {
         	if (http_request.status == 200) {
             	result = http_request.responseText;
            	document.getElementById(div).innerHTML = result; 
				if(div == 'p_attrib')
				{           
					htmlData("/header_cart.php",'','topcartbox_new');
				}
         	}
			 
      		}else
			{
				if(document.getElementById(div))	
					document.getElementById(div).innerHTML="<img src='images/loading.gif'   border=0>";
			}
		}
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

	
	  function get(obj) {
	
	cnt = document.getElementById('cnt').value;
	
	pststr = "";
	for(i=1;i<=cnt;i++)
	{
		ans = document.getElementById('pollcnt'+i);
	
		if(ans.checked)
		{
			pststr += "&poll_ans[]="+ans.value;
		}
	}
	
	  var poststr = "poll_id=" + encodeURI( document.getElementById("poll_id").value ) +
					"&poll=" + encodeURI( document.getElementById("poll").value + pststr);
	  makePOSTRequest('/poll.php', poststr,'myspan');
	   }
	   

function html_get_ip_country_popup(url,qstring,div)
{
	if (url.length==0)
	{
		return;
	}
	if(getCookie('IS_REDIRECT'))
	{
		if(getCookie('REDIRECT_URL') != "")
		{	
			location.href=getCookie('REDIRECT_URL');
		}
		return;
		
	}

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		return;
	}
	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
				if(xmlHttp.responseText != 'false' && xmlHttp.responseText != '')
				{
					hs.lang.loadingText = '';
					hs.align = 'center';
					hs.htmlExpand ( document.getElementById('anchor'), { src: xmlHttp.responseText, objectType: 'ajax',maxWidth:320});
				}
	
		}
	}

	if(qstring!='')
		url=url+"&"+qstring;
		
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null);
}

function redirect_ip_popup()
{
	if(getCookie('IS_REDIRECT'))
	{
		if(getCookie('REDIRECT_URL') != "")
		{	
			location.href=getCookie('REDIRECT_URL');
		}
		return;
		
	}
}
