// JavaScript Document
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
MM_preloadImages('/images/common/main_bg.gif','/images/top_bg.gif','/images/common/main_bg.gif','/images/common/top_bg2.jpg','/images/common/main_bg.gif','/images/common/category_left_mac.gif','/images/common/category_left_mac.gif','/images/common/product_list_bg.gif','/images/common/title_bg.gif','/images/common/category_bg.gif','/images/common/black_arrow.gif','/images/common/category_bg_mac.gif','/images/common/mac_list_bg.gif','/images/common/mac_list_bottom.gif','/images/common/product_list_bottom.gif','/images/t_menu_bg.gif','/images/t_menu_left.gif','/images/t_menu_right.gif','/images/t_menu_h.gif','/images/t_menu_on.gif')

function change_pic(_this,x){
	_this.src= x;
}

function change_class(_this,x){
	_this.className=x;
}

function change_con(_this,x1,x2){
	if(document.getElementById(x2).style.display=="none"){
		document.getElementById(x2).style.display="";
		document.getElementById(x1).style.display="none";
		_this.src="images/common/arrow_up.gif";
		_this.alt="Shrink";
	}
	else{
		document.getElementById(x2).style.display="none";
		document.getElementById(x1).style.display="";
		_this.src="images/common/arrow_down.gif";
		_this.alt="Expand";
	}
}


function tab_effect03(tab,content,x){
	for(i=1;i<=x;i++){
		document.getElementById("tab"+i).className="";
		document.getElementById("content"+i).style.display="none";
	}
	document.getElementById(tab).className="tab_on";
	document.getElementById(content).style.display="";
}

function tab_effect(tab,content,x){
	for(i=1;i<=x;i++){
		document.getElementById("tab"+i).className="";
		document.getElementById("content"+i).style.display="none";
	}
	document.getElementById(tab).className="tab_on";
	document.getElementById(content).style.display="";
}





//function tab_effect(tab,content,x){
//	for(i=1;i<=x;i++){
//		if(i!=1){
//		document.getElementById("tab"+i).className="";
//		if (i==7){document.getElementById("tab"+i).className="all_p";}
//		document.getElementById("content"+i).style.display="none";
//		}}
//	document.getElementById(tab).className="tab_on";
//	if(tab=="tab7"){document.getElementById(tab).className="all_p tab_on";}
//	document.getElementById(content).style.display="";
//}

function tab_effect02(tab,content,x){
	for(i=1;i<=x;i++){
		document.getElementById("tab0"+i).className="";
		document.getElementById("content0"+i).style.display="none";
	}
	document.getElementById(tab).className="tab_on";
	document.getElementById(content).style.display="";
}

function tab_effects(tab,content,a,b){
	for(i=a;i<=b;i++){
		document.getElementById("tab"+i).className="";
		document.getElementById("content"+i).style.display="none";
	}
	document.getElementById(tab).className="tab_on";
	document.getElementById(content).style.display="";
}

function for_download(but,list){
	if(document.getElementById(list).style.display=="none"){
		document.getElementById(but).src="images/common/download_hover.gif";
		document.getElementById(list).style.display="";
	}
	else{
		document.getElementById(but).src="images/common/download.gif";
		document.getElementById(list).style.display="none";
	}
}

// for family download and buy choose
function choosen(_this){
	document.getElementById("links").href=_this.value;
}
// for all ad
tab1="tab1";
content1="content1";
tab2="tab2";
content2="content2";
function selecttag(showContent, selfObj) {
    var tag = document.getElementById("tags").getElementsByTagName("li");
    var taglength = tag.length;
    for (i = 0; i < taglength; i++) {
        tag[i].className = "";
    }
    selfObj.parentNode.className = "selecttag";
    for (i = 0; j = document.getElementById("tagContent" + i); i++) {
        j.style.display = "none";
    }
    document.getElementById(showContent).style.display = "block";
}


//b_RoundCurve
function b_RoundCurve(classname,b_c,bg_c,state,tagname,titlebg,titleimg){	
	var divs=getElementsByClassName(classname);
	for(var i=0;i<divs.length;i++){
		var obj=divs[i];
		var path=window.location.href;
		path=path.substring(0,path.lastIndexOf('/')+1);
		var comstyle="height:1px; font-size:1px;overflow:hidden; display:block;";
		var b1="margin:0 5px;";
		var b2="margin:0 3px;border-right:2px solid; border-left:2px solid;";
		var b3="margin:0 2px;border-right:1px solid; border-left:1px solid;";
		var b4="margin:0 1px;border-right:1px solid; border-left:1px solid;height:2px;";
		var content="border-right:1px solid;border-left:1px solid;overflow:hidden; position:relative; z-index:0;";
		var bgColor="background:"+bg_c+";";
		
		var imgPos2="background-position:-4px top;";
		var imgPos3="background-position:-2px -1px;";
		var imgPos4="background-position:-1px -2px;";
		var conPos="background-position:left -4px;";
		var imgPos5="background-position:-1px bottom;";
		var imgPos6="background-position:-2px bottom;";
		var imgPos7="background-position:-4px bottom;";
		
		var imgBgStr,imgPos3,imgPos4,conPos,imgPos5,imgPos6,imgPos7;
		var b_img2,b_img3,b_img4,b_img5,b_img6,b_img7,c_img,imgurl;
		
		if(state==1){
			b_img2=bgColor;
			b_img3=bgColor;
			b_img4=bgColor;
			c_img=bgColor;
			b_img5=bgColor;
			b_img6=bgColor;
			b_img7=bgColor;
	    }
		if(state==2){
			var imgObj=divs[i].getElementsByTagName('img')[0];
			var imgheight=imgObj.height;
			var contentheight=imgheight-10;
			var imgweight=imgObj.width;
			obj.style.width=(imgweight+2)+"px";
			var imgsrc=imgObj.src.replace(path,'');
			var imgBgStr="background:url("+imgsrc+") no-repeat;";
			conPos="height:"+contentheight+"px;width:"+imgweight+"px;overflow:hidden;";	
			
			b_img2=imgBgStr+imgPos2;
			b_img3=imgBgStr+imgPos3;
			b_img4=imgBgStr+imgPos4;
			c_img=conPos;
			b_img5=imgBgStr+"background-position:-1px -"+ (imgheight-4)+"px;";
			b_img6=imgBgStr+"background-position:-2px -"+ (imgheight-2)+"px;";
			b_img7=imgBgStr+"background-position:-4px -"+ (imgheight-1)+"px;";
			imgurl=imgsrc;
		}
		if(state==3){
		    var objh3=obj.getElementsByTagName(tagname)[0];
			if(titleimg!=null){
				var bgimg="background:url("+titleimg+") repeat-x;";
				b_img2=bgimg+imgPos2;
				b_img3=bgimg+imgPos3;
				b_img4=bgimg+imgPos4;
				objh3.style.background="url("+titleimg+") repeat-x left -4px";
				objh3.style.borderBottomColor=b_c;
			}
			else{
				var bg_c="background:"+titlebg+";";
				b_img2=bg_c;
				b_img3=bg_c;
				b_img4=bg_c;
				objh3.style.background=titlebg;
				objh3.style.borderBottomColor=b_c;
			}
			c_img=bgColor;
			b_img5=bgColor;
			b_img6=bgColor;
			b_img7=bgColor;

		}
		if(state==4){
			var bgimg=getStyle(obj,"backgroundImage");
			var bgWidth=getStyle(obj,"width");
			bgimg=bgimg.replace(path,"");
			bgimg=bgimg.substring(4,bgimg.length);
			bgimg=bgimg.substring(0,bgimg.length-1);
			var bgimgheight=getStyle(obj,"height");
			
			bgimgheight=bgimgheight.replace("px","");
			var contentheight=bgimgheight-10;
			bgWidth=bgWidth.replace("px","");
			bgWidth=bgWidth-2;
			
			bgimg=bgimg.replace("url(\"","");
			bgimg=bgimg.replace("\")","");
			path=path.substring(0,(path.lastIndexOf('/')+1));
			bgimg=bgimg.replace(path,"");
			imgBgStr="background:url("+bgimg+") no-repeat;";
			obj.style.background="none";
			b_img2=imgBgStr+imgPos2;
			b_img3=imgBgStr+imgPos3;
			b_img4=imgBgStr+imgPos4;
			c_img=imgBgStr+conPos+"height:"+contentheight+"px;width:"+bgWidth+"px;";

			
			b_img5=imgBgStr+"background-position:-1px -"+ (bgimgheight-4)+"px;";
			b_img6=imgBgStr+"background-position:-2px -"+ (bgimgheight-2)+"px;";
			b_img7=imgBgStr+"background-position:-4px -"+ (bgimgheight-1)+"px;";
		}
		if(state==2 || state==4){
			conDivHeight="";
	    }
		else{
			var H=getStyle(obj,"height");
			H=H.replace("px","");
			conDivHeight="height:"+(H-8)+"px";
		}
		var rDivStr="<b style='"+ comstyle+b1+"background:"+b_c+"'></b>";
		rDivStr+="<b style='"+ comstyle+b2+"border-color:"+b_c+";"+b_img2+"'></b>";
		rDivStr+="<b style='"+ comstyle+b3+"border-color:"+b_c+";"+b_img3+"'></b>";
		rDivStr+="<b style='"+ comstyle+b4+"border-color:"+b_c+";"+b_img4+"'></b>";
		rDivStr+="<div style='"+content+"border-color:"+b_c+";"+c_img+conDivHeight+"'>";
		rDivStr+="@d_P";
		rDivStr+="</div>";
		rDivStr+="<b style='"+ comstyle+b4+"border-color:"+b_c+";"+b_img5+"'></b>";
		rDivStr+="<b style='"+ comstyle+b3+"border-color:"+b_c+";"+b_img6+"'></b>";
		rDivStr+="<b style='"+ comstyle+b2+"border-color:"+b_c+";"+b_img7+"'></b>";
		rDivStr+="<b style='"+ comstyle+"margin:0 5px;background:"+b_c+"'></b>";
		
		var htmlText=divs[i].innerHTML;
		if(state==2){
			var str1=htmlText.replace("src=\"","src=\"*");
			var strsplit1=str1.split('*')[0];
			var strsplit2=str1.split('*')[1];
			var url=strsplit2.substring(0,strsplit2.indexOf('\"'));
			htmlText=strsplit1+imgurl+"\" style='border:0px;position:absolute;top:-4px;left:0px;'/>";
		}
		rDivStr=rDivStr.replace('@d_P',htmlText);
		divs[i].innerHTML=rDivStr;
	}
}

function getStyle( elem, name )
{
	if (elem.style[name])
	{
		return elem.style[name];
	}
	else if (elem.currentStyle)
	{
		return elem.currentStyle[name];
	}
	else if (document.defaultView && document.defaultView.getComputedStyle)
	{
		name = name.replace(/([A-Z])/g,"-$1");
		name = name.toLowerCase();
		var s = document.defaultView.getComputedStyle(elem,"");
		return s && s.getPropertyValue(name);
	}
	else
	{
		return null;
	}
}
function getElementsByClassName(searchClass, node,tag){  
	if(document.getElementsByClassName){return  document.getElementsByClassName(searchClass)}
	else{        
		node = node || document;        
		tag = tag || "*";        
		var classes = searchClass.split(" "),        
		elements = (tag === "*" && node.all)? node.all : node.getElementsByTagName(tag),        
		patterns = [],         
		returnElements = [],        
		current,         
		match;        
		var i = classes.length;       
		while(--i >= 0){patterns.push(new RegExp("(^|\\s)" + classes[i] + "(\\s|$)"));}        
		var j = elements.length;       
		while(--j >= 0){            
			current = elements[j];           
			match = false;            
			for(var k=0, kl=patterns.length; k<kl; k++){                
				match = patterns[k].test(current.className);                
				if (!match)  break;           
			} 
			if (match)  returnElements.push(current);        
		}        
		return returnElements;   
	} 
}


