// JavaScript Document
function doHot(b,strT){
	b.className="searchSeld";
	var j;
	var id;
	//var e;
	for(var i=1;i<=2;i++){
		id ="searchCard"+i;
		j = document.getElementById(id);
		//e = document.getElementById("BoardList"+i);// ʾ 
		document.getElementById("A").value=strT
		if(id != b.id){
			j.className="";
			//e.style.display = "none";
		}else{
			//e.style.display = "block";
		}
	}
}
/*
-------------------------------------------------
	b-------- (this)
	bClass-----
	idName---------ID
	forN-------
	secondName---------ID
-------------------------------------------------
*/
function doCard(b,bClass,idName,forN,secondName){
	b.className=bClass;
	var j;
	var id;
	var e;
	for(var i=1;i<=forN;i++){
		id =""+idName+""+i;
		j = document.getElementById(id);
		e = document.getElementById(""+secondName+""+i);//   
		if(id != b.id){
			j.className="";
			e.style.display = "none";
		}else{
			e.style.display = "block";
		}
	}
}

function viewlist(sID,zID,iconID){
	var ss=document.getElementById(sID)
	var zk=document.getElementById(zID)
	var icon=document.getElementById(iconID)
	//alert(ss)
	if (zk.style.display == "none"){
		zk.style.display="block"
		ss.style.display="none"
		icon.src='/images/_.gif'
	}else{
		zk.style.display="none"
		ss.style.display="block"
		icon.src='/images/+.gif'
	}	
}
function gotoPage(URL1,URL2,URL3,pageVal){
	if (pageVal==""){pageVal=1}
		window.location=URL1+"_"+pageVal+URL2+".html?"+URL3+"";
}
function $(id){
	return document.getElementById(id);
}
function textLimitCheck(thisArea,maxLength,backMSG){
    if (thisArea.value.length > maxLength);
    {
		thisArea.value = thisArea.value.substring(0, maxLength);
        thisArea.focus();
    }
    document.getElementById(backMSG).innerHTML = maxLength-thisArea.value.length;
}
function Inquire(){
	var suppliersIDlength=document.formBasket.suppliersID.length;
		for(i=0;i<suppliersIDlength;i++){
			if(document.formBasket.suppliersID[i].checked){
				document.formBasket.action="http://www.chinacommodity.net/app/SendInquiry.asp"
				document.formBasket.method="get"
				document.formBasket.submit();
				return true;
				break;
			}
		}
		alert("No item(s) selected.");
}
function AddToBasket(){
	document.formBasket.action='http://www.chinacommodity.net/app/addToBasket.asp';
	document.formBasket.submit();
	return true;
}
function selectAll(obj){
	for(var i=0;i<obj.length;i++){
		obj[i].checked=true;
		}
}
function selectClear(obj){
	for(var i=0;i<obj.length;i++){
		obj[i].checked=false;
		}
}
function sAlert(popText,titleName,StyleWidth,StyleHeight){
   // var eSrc=(document.all)?window.event.srcElement:arguments[1];
	var iWidth = document.documentElement.clientWidth; 
	var iHeight = document.documentElement.scrollTop; 
	var ScreenHeight =document.documentElement.clientHeight;
    var shield = document.createElement("DIV");
    shield.id = "shield";
    shield.style.position = "absolute";
    shield.style.left = "0px";
    shield.style.top = "0px";
    shield.style.width = "100%";
    shield.style.height = ((document.body.clientHeight>document.body.scrollHeight)?document.body.clientHeight:document.body.scrollHeight)+"px";
    shield.style.background = "#000";
    shield.style.textAlign = "center";
    shield.style.zIndex = "1001";
    shield.style.filter = "alpha(opacity=20)";
    shield.style.opacity = 0;

    var alertFram = document.createElement("DIV");
    alertFram.id="alertFram";
    alertFram.style.position = "absolute";
    alertFram.style.left =(iWidth-StyleWidth)/2+"px";
    alertFram.style.top = (((ScreenHeight-StyleHeight)/2)+iHeight)+"px";
    //alertFram.style.marginLeft ="auto";
    //alertFram.style.marginRight ="auto";
    alertFram.style.width = StyleWidth+"px";
    //alertFram.style.height = StyleHeight+"px";
    alertFram.style.background = "";
    alertFram.style.zIndex = "1002";

	var s=document.getElementsByTagName("select"); 
	for(var j=0;j<s.length;j++){s[j].style.visibility="hidden";} 
    
	strHtml  = "<div id='popborder'>"
	strHtml += "<div id='poptitle'><span><a href='javascript:void(null);' onclick='doOk();'><img src='images/close.gif' border='0' /></a></span>"+titleName+"</div>"
	strHtml += "<div id='poptext'>"+popText+"</div>"
	strHtml += "</div>"

    alertFram.innerHTML = strHtml;
    document.body.appendChild(alertFram);
    document.body.appendChild(shield);
	
//dissolve
    this.setOpacity = function(obj,opacity){
        if(opacity>=1)opacity=opacity/100;
        try{ obj.style.opacity=opacity; }catch(e){}
        try{ 
            if(obj.filters.length>0&&obj.filters("alpha")){
                obj.filters("alpha").opacity=opacity*100;
            }else{
                obj.style.filter="alpha(opacity=\""+(opacity*100)+"\")";
            }
        }catch(e){}
    }
    
    //var c = 0;
    this.doAlpha = function(){
        setOpacity(shield,20);
		clearInterval(ad);return 0;		
    }
    var ad = setInterval("doAlpha()",1);
    
    this.doOk = function(){
		var s=document.getElementsByTagName("select"); 
		for(var j=0;j<s.length;j++){s[j].style.visibility="";} 
        //alertFram.style.display = "none";
        //shield.style.display = "none";
        document.body.removeChild(alertFram);
        document.body.removeChild(shield);
        //eSrc.focus();
        //document.body.onselectstart = function(){return true;}
        //document.body.oncontextmenu = function(){return true;}
    }
    //document.getElementById("Send").focus();
    //eSrc.blur();
    //document.body.onselectstart = function(){return false;}
    //document.body.oncontextmenu = function(){return false;}
}
function getAction(obj){
	var strAC=obj.form.A.value;
	var strK=obj.form.K.value;
	if (strK==""){
		alert("Please input a search term.");
	}else{
		obj.form.action=strAC+strK+".html";	
		obj.form.submit();
	}
}
