﻿// TAG 滑动标签导航
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";
	
	
}

function selecttags_des(showContent,selfObj){
	// 操作标签
	var tag = document.getElementById("tags_des").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_des"+i); i++){
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";
	
	
}

//设计中心
function selecttags_stuff(showContent,selfObj){
	// 操作标签
	var tag = document.getElementById("tags_stuff").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_stuff"+i); i++){
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";
	
	
}

//循环改变
function qiehuan(num,num2){
	for(var id = 0;id<=15;id++)
	{
		if(id==num)
		{
			document.getElementById("mynav"+id).className="nav_on";
		}
		else
		{
			document.getElementById("mynav"+id).className="";
		}
	}
}
	
	//循环改变
function qiehuan1(num,num2){
    for(var id = 0;id<=14;id++)
    {
	    if(id==num)
	    {
		    document.getElementById("mynav"+id).className="nav_on";
	    }
	    else
	    {
		    document.getElementById("mynav"+id).className="";
	    }
    }
}

//局部套餐循环
function changejb(num,num2){
    for(var id = 1;id<=num2;id++)
    {
	    if(id==num)
	    {
		    document.getElementById("jbp"+id).style.display = "block";
	    }
	    else
	    {
		    document.getElementById("jbp"+id).style.display = "none";
	    }
    }
}
	
//	for(var id = 0;id<=3;id++)
//	{
//		if(id==num2)
//		{
//			document.getElementById("qh_con"+id).className="mousecheck";
//		}
//		else
//		{
//			document.getElementById("qh_con"+id).className="menufl";
//		}
//	}

//初始化
function loadhome()
{
    document.getElementById("qh_con0").className="mousecheck";
}
function loadpackage()
{
    document.getElementById("qh_con1").className="mousecheck";
}
function loadoutfit()
{
    document.getElementById("qh_con2").className="mousecheck";
}
function loadservice()
{
    document.getElementById("qh_con3").className="mousecheck";
}

//LI的hover事件
function outli(liobj){
    document.getElementById(liobj).className="atvimg";
}
function overli(liobj){
    document.getElementById(liobj).className="hoverimg";
}

function acoutli(obj){
    document.getElementById(obj).className="noutli";
}
function acoverli(obj){
    document.getElementById(obj).className="noverli";
}


//Validat
//加入收藏
function addfavor(url,title) {
     if(confirm("网站名称："+title+"\n网址："+url+"\n确定添加收藏?")){
         var ua = navigator.userAgent.toLowerCase();
         if(ua.indexOf("msie 8")>-1){
             external.AddToFavoritesBar(url,title,'');//IE8
         }else{
             try {
                 window.external.addFavorite(url, title);
             } catch(e) {
                 try {
                     window.sidebar.addPanel(title, url, "");//firefox
                 } catch(e) {
                     alert("加入收藏失败，请使用Ctrl+D进行添加");
                 }
             }
         }
     }
     return false;
}

//切换城市
function ChangeCity(num,num2)
{
    for(var id = 1;id<=num2;id++)
	    {
		    if(id==num)
		    {
			    document.getElementById("changeCity"+id).style.display = "block";
		    }
		    else
		    {
			    document.getElementById("changeCity"+id).style.display = "none";
		    }
	    }
}


//切换活动
function ChangeActive(num,num2)
{
    for(var id = 1;id<=num2;id++)
	    {
		    if(id==num)
		    {
		        document.getElementById("meun"+id).style.fontSize="18px";
		        document.getElementById("meun"+id).style.fontWeight="700";
		        document.getElementById("meun"+id).style.color="#d80009";
		        //document.getElementById("meun"+id).className="actfonttxtc";
			    document.getElementById("actvc"+id).style.display = "block";
			    
		    }
		    else
		    {
		        document.getElementById("meun"+id).style.fontSize="18px";
		        document.getElementById("meun"+id).style.fontWeight="700";
		        document.getElementById("meun"+id).style.color="#000";
		        //document.getElementById("meun"+id).className="actfonttxt";
			    document.getElementById("actvc"+id).style.display = "none"; 
		    }
	    }
}

var flag=false;
function DrawImage(ImgD,w,h){
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= h/w){
    if(image.width>h){
    ImgD.width=h;
    ImgD.height=(image.height*h)/image.width;
    }else{
    ImgD.width=image.width;
    ImgD.height=image.height;
    }
    ImgD.alt=image.width+"x"+image.height;
    }
    else{
    if(image.height>w){
    ImgD.height=w;
    ImgD.width=(image.width*w)/image.height;
    }else{
    ImgD.width=image.width;
    ImgD.height=image.height;
    }
    ImgD.alt=image.width+"x"+image.height;
    }
    }
}





