//产品与购买侧边栏导航
function ProductNav(productId,current_productnav){
 var p660="style='background:#F5F5F5'" ;
 var p650="style='background:#ffffff;'" ;
 var p628="style='background:#F5F5F5'" ;
 var p607="style='background:#ffffff;'" ;
 var p606="style='background:#F5F5F5;border-bottom:1px solid #CCCCCC;'" ;
 if(productId=="p660"){
 	 p660 =  p660+" id=\"fn-select\"";
 }
 if(productId=="p650"){
 	 p650 =  p650+" id=\"fn-select\"";
 }
 if(productId=="p628"){
	 p628 =  p628+" id=\"fn-select\"";
 }
 if(productId=="p607"){
	 p607 =  p607+" id=\"fn-select\"";
 }
 if(productId=="p606"){
	 p606 =  p606+" id=\"fn-select\"";
 }
 var linkstr ="";
 if(current_productnav=="appraisal"){
   document.write("<ul>");
   document.write("<li "+p660+"><a href=\"product_"+current_productnav+".html?current_product=p660\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\">P660</a></li>");
   document.write("<li "+p650+"><a href=\"product_"+current_productnav+".html?current_product=p650\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\">P650</a></li>");
   document.write("<li "+p628+"><a href=\"/product/p628_feature.html\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\" >P628</a></li>");
   document.write("<li "+p607+"><a href=\"/product/p607_feature.html\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\" >P607</a></li>");
   document.write("<li "+p606+"><a href=\"/product/p606_feature.html\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\" >P606</a></li>");
   document.write("</ul>");
 }else{
   document.write("<ul>");
	   document.write("<li "+p660+"><a href=\"p660_"+current_productnav+".html?current_product=p660\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\" >P660</a></li>");
	   document.write("<li "+p650+"><a href=\"p650_"+current_productnav+".html?current_product=p650\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\" >P650</a></li>");
	   document.write("<li "+p628+"><a href=\"/product/p628_feature.html\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\" >P628</a></li>");
	   document.write("<li "+p607+"><a href=\"/product/p607_feature.html\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\" >P607</a></li>");
	   document.write("<li "+p606+"><a href=\"/product/p606_feature.html\"><img src=\"../images/daohang.png\" width=\"25\" height=\"25\" >P606</a></li>");
   document.write("</ul>");
 }
}

//单个产品选项卡
function PublicNav(productId,productnav){
 var feature="class='tab_nav_nosel'" ;
 var gallery="class='tab_nav_nosel'" ;
 var designer="class='tab_nav_nosel'" ;
 var technic="class='tab_nav_nosel'"; 
  var ue="class='tab_nav_nosel'";
 var appraisal="class='tab_nav_nosel'"; 
 if(productnav=="feature"){
	 feature =  "class='tab_nav_sel'";
 }
 if(productnav=="gallery"){
	 gallery =  "class='tab_nav_sel'";
 }
  if(productnav=="designer"){
	 designer =  "class='tab_nav_sel'";
 }
  if(productnav=="technic"){
	 technic =  "class='tab_nav_sel'";
 }
  if(productnav=="ue"){
	 ue =  "class='tab_nav_sel'";
 }
 if(productnav=="appraisal"){
	 appraisal =  "class='tab_nav_sel'";
 }
document.write("<div id=\"tab_container\">");
  document.write("<div id=\"label_div\">");
  	document.write("<img src=\"images/tab_nav/label_"+productId+".png\">");
  document.write("</div>");
  document.write("<div id=\"tab_div\">");
  	document.write("<ul id=\"tab_nav\">");
		if(productId=="p607"){
			document.write("<li><a "+feature+" href=\"/product/p607_feature.html\">功能</a></li>");
		}else if(productId=="p606"){
			document.write("<li><a "+feature+" href=\"/product/p606_feature.html\">功能</a></li>");
		}else if(productId=="p628"){
			document.write("<li><a "+feature+" href=\"/product/p628_feature.html\">功能</a></li>");
		}else{
			document.write("<li><a "+feature+" href=\"javascript:GoLink(\'feature\');\">功能</a></li>");
		}
		document.write("<li><a "+gallery+" href=\"javascript:GoLink(\'gallery\');\">图库</a></li>");
		document.write("<li><a "+technic+" href=\"javascript:GoLink(\'technic\');\">技术规格</a></li>");
		document.write("<li><a "+ue+" href=\"javascript:GoLink(\'ue\');\">用户体验</a></li>");
		document.write("<li><a "+appraisal+" href=\"javascript:GoLink(\'appraisal\');\">产品评论</a></li>");
	document.write("</ul>");
  document.write("</div>");
 
document.write("</div>");
}

/*跳转链接*/
function GoLink(productnav){
  var current_product=document.getElementById("current_product").value;
  if(productnav=="designer"){
	  window.location.href="product_designer.html?current_product="+current_product;
  }else if(productnav=="appraisal"){
  	  window.location.href="product_appraisal.html?current_product="+current_product;
  }else{
      window.location.href=current_product+"_"+productnav+".html?current_product="+current_product;
  }  
}

/*取滚动条高度*/
function getScrollTop()
{
    var scrollTop=0;
    if(document.documentElement&&document.documentElement.scrollTop)
    {
        scrollTop=document.documentElement.scrollTop;
    }
    else if(document.body)
    {
        scrollTop=document.body.scrollTop;
    }
    return scrollTop;
}


/**
 功能：配件中鼠标放在小图上显示大图的功能
*/
//document.write("<div id='showpostdetail' class='dv'></div>");
function showdetail(eve,w,wHeight){
	var objPos = mousePosition(eve);
	var x=objPos.x+20;
	//var y=objPos.y;	
	//var x=650;
	var y=getScrollTop()+200;	
	//alert(x+"-"+y);
	document.getElementById("showpostdetail").innerHTML=document.getElementById(w).innerHTML + "<br>";
	document.getElementById("showpostdetail").style.visibility="visible";
	document.getElementById("showpostdetail").style.display="block";
	//document.getElementById("showpostdetail").style.position="relative";
	//document.getElementById("showpostdetail").style.zIndex="999";
//alert(document.getElementById("showpostdetail").style.left);
//首先判断浏览器的版本
	  /* var Sys = {};
        var ua = navigator.userAgent.toLowerCase();
        if (window.ActiveXObject)
            Sys.ie = ua.match(/msie ([\d.]+)/)[1]
        else if (document.getBoxObjectFor)
            Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
        else if (window.MessageEvent && !document.getBoxObjectFor)
            Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
        else if (window.opera)
            Sys.opera = ua.match(/opera.([\d.]+)/)[1]
        else if (window.openDatabase)
            Sys.safari = ua.match(/version\/([\d.]+)/)[1];
        */
       // if(parseInt(Sys.ie)<7){
		//	x=x;
		//}else{
			x=x;
		//}

	document.getElementById("showpostdetail").style.left=(x)+"px";
	var screenHeight = window.screen.availHeight;//770
	var realy;
    y=y-96;
	if(y+wHeight>screenHeight){//超过了下面
		realy=y-wHeight;
	}else{
		realy=y;
	}
	document.getElementById("showpostdetail").style.top=realy+"px";
}
function hidedetail(){
	document.getElementById("showpostdetail").style.innerHTML=""
	document.getElementById("showpostdetail").style.visibility="hidden";
	document.getElementById("showpostdetail").style.display="None";
}

/**
 功能：获取鼠标坐标值
*/
function mousePosition(ev) {
 if(ev.pageX || ev.pageY){
    return {x:ev.pageX, y:ev.pageY};
 }
 //下面返回的是IE的坐标值
 return { x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,y:ev.clientY + document.body.scrollTop-document.body.clientTop
 };
}

/*实现esc键时，关闭小功能窗口效果,目前仅firefox下可用*/
 var etarget = document.body; 
    document.onclick = function (event) 
    {  event = event || window.event; 
        etarget = event.target || event.srcElement; 
    } 
    document.onkeyup = function ( event  ) 
    { 
        event = event || window.event; 
        var srElement = event.target || event.srcElement; 
       // alert( etarget.tagName ); 
	   if(event.keyCode==27){
		   closeWindow();
	   }
    }; 

/**
 *功能：得到服务器地址
 */
//function getServerAddr(){
//}

function getServerAddr(){
	return "/routonlifeClient/";	
}