function getHTMLstate(pageURL) {
    var xmlHttpReq = false;
    var self = this;
	var textResult ;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', pageURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            textResult	= self.xmlHttpReq.responseText ;
			//Set the result on the DIV
			document.getElementById("StateDiv").style.display	= '';
			document.getElementById("StateDiv").innerHTML		= textResult;
        }
    }
    self.xmlHttpReq.send();
}

function changeState()
{
	document.location.href = 'http://'+document.getElementById("stateList").value+'.card4biz.com';
}

function changeLan()
{
	var hrefS	= document.location.href.toLowerCase() ;
	if (hrefS.indexOf('&tran=')>-1)
	{
		hrefS	= hrefS.replace(hrefS.substr(hrefS.indexOf('&tran='),hrefS.indexOf('&tran=')+12),"");
	}
	if (hrefS.indexOf('?tran=')>-1)
	{
		hrefS	= hrefS.replace(hrefS.substr(hrefS.indexOf('?tran='),hrefS.indexOf('?tran=')+12),"");
	}
	if (hrefS.indexOf('?')>-1)
		hrefS	= hrefS+'&tran='+document.getElementById("languageList").value+'';
	else
		hrefS	= hrefS+'?tran='+document.getElementById("languageList").value+'';

	document.location.href = hrefS ;
}

function Left(str, n){
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
}

function MakeCut(catUrlTXT,moreCatTXT) {
	//Get all the cutting category
	var allCutCat	= ""
	for(var i=0;i<=document.getElementsByName('cutCat_id').length-1;i++)
		if (document.getElementsByName('cutCat_id')[i].checked)
			allCutCat	= allCutCat + document.getElementsByName('cutCat_id')[i].value + '-'
	//Send the user to the result page
	if (moreCatTXT!="")
		document.location.href	= '/index/p/'+catUrlTXT+'?w='+moreCatTXT+'-'+Left(allCutCat,allCutCat.length-1)+''
	else
		document.location.href	= '/index/p/'+catUrlTXT+'?w='+Left(allCutCat,allCutCat.length-1)+''
}

function showHideButton() {
	//Check if to show or hide the button of the cut
	var ImCheckBOO		= 0 ;
	for(var i=0;i<=document.getElementsByName('cutCat_id').length-1;i++)
	{
		if (document.getElementsByName('cutCat_id')[i].checked)
			ImCheckBOO	= 1
	}
	if (ImCheckBOO)
		document.getElementById('cutBox').style.display=''
	else
		document.getElementById('cutBox').style.display='none'
}



/***********************************************
* Open select links in new window script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/*****************USAGE NOTES:*****************
Add: <form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="applywindow(targetlinks)">Open designated links in new window</form>

anywhere on your page to automatically switch the script to manual mode, whereby only checking a checkbox will cause designated links to open in a new window. Customize the form as desired, but preserve key information such as the name attributes and onClick command. Remove form to switch back to auto mode.
***********************************************/

var linktarget="_blank" //Specify link target added to links when set to open in new window

var formcache=document.targetmain

function applywindow(){
if (typeof targetlinks=="undefined") return
if (!formcache || (formcache && formcache.targetnew.checked)){
for (i=0; i<=(targetlinks.length-1); i++)
targetlinks[i].target=linktarget
}
else
for (i=0; i<=(targetlinks.length-1); i++)
targetlinks[i].target=""
}


function collectElementbyClass(){
if (!document.all && !document.getElementById) return
var linksarray=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className=="nwindow")
linksarray[inc++]=alltags[i]
if (alltags[i].className=="nwindowcontainer"){
var alldivlinks=document.all? alltags[i].all.tags("A") : alltags[i].getElementsByTagName("A")
for (t=0; t<alldivlinks.length; t++)
linksarray[inc++]=alldivlinks[t]
}
}
return linksarray
}
if (formcache && formcache.targetnew.checked) //overcome IE bug, manually check checkbox that has "checked" attribute
setTimeout("document.targetmain.targetnew.checked=true",100)
var targetlinks=collectElementbyClass()
applywindow()