﻿//设为首页
function $HomePage(inOBJ,inURL){
	inOBJ.style.behavior='url(#default#homepage)';
	inOBJ.setHomePage(inURL);
	return false
}
//加入收藏夹
function $Favorite(inURL,inTITLE){
	switch($GetIE()){
		case "IE": window.external.addFavorite(inURL,inTITLE);break;
		case "Firefox": window.sidebar.addPanel(inTITLE, inURL, "");break;
		case "Opera":
			var Opera = document.createElement('a');Opera.setAttribute('rel','sidebar');
			Opera.setAttribute('href',inURL);Opera.setAttribute('title',inTITLE);Opera.click();break;
	}
}
//判断浏览器
function $GetIE(){ 
   if(navigator.userAgent.indexOf("MSIE")>=0) return "IE"; 
   if(navigator.userAgent.indexOf("Firefox")>=0) return "Firefox"; 
   if(navigator.userAgent.indexOf("Opera")>=0) return "Opera"; 
   return "No"; 
}
//判断浏览器版本
function $IEVer(){ 
	if(navigator.userAgent.indexOf("MSIE 5.0")>=0) return "IE5.0"; 
	if(navigator.userAgent.indexOf("MSIE 5.5")>=0) return "IE5.5"; 
	if(navigator.userAgent.indexOf("MSIE 6.0")>=0) return "IE6.0";
	if(navigator.userAgent.indexOf("MSIE 7.0")>=0) return "IE7.0";
	if(navigator.userAgent.indexOf("MSIE 8.0")>=0) return "IE8.0";
	if(navigator.userAgent.indexOf("Firefox")>=0) return "Firefox"; 
	if(navigator.userAgent.indexOf("Opera")>=0) return "Opera"; 
	return "No"; 
}
//53客服
function $KeFu()
{
	window.open("http://www.53kf.com/company.php?arg=lyhd&style=1","","Width=700px,Height=470px,top=100,left=100,status=no,scrollbars=no")

}
//弹出窗口
function $Alert(inMsg)
{
	alert(inMsg);
}
//菜单控制
function $Menu(inCount)
{
	$(".menu a").eq(Number(inCount)-1).attr("class","a");
	if(Number(inCount)==1)$("body").css("background","#EEE")
}
function $MenuLeft(inCount)
{
	$(".mleft p").eq(Number(inCount)-1).addClass("p");
}

function $Toggle(inThis,inID)
{
	$("#"+inID).toggle();
	if($("#"+inID).css("display")=="none")
	{
		$("#"+inThis).removeClass('p')
	}
	else
	{
		$("#"+inThis).addClass('p')
	}
	
}
//标签控制
function $Label(inTitle,inCount)
{
	$("#"+inTitle+"Title p").each(function(){$(this).removeClass("p")});
	$("#"+inTitle+"Title p").eq(Number(inCount)).addClass("p");
	
	$("#"+inTitle+"Txt p").each(function(){$(this).hide()});
	$("#"+inTitle+"Txt p").eq(Number(inCount)).show();
}
//URL转向
function $URL(inURL)
{
	location.href=inURL;
}
//QQMSN
function $QQMSN(inAccount)
{
	if(inAccount.indexOf("@")==-1){
		$URL("tencent://message/?uin="+inAccount+"&Site=qq在线客服&Menu=yes");
	}
	else
	{
		$URL("msnim:chat?contact="+inAccount);
	}
}
//FLASH
function $Flash(inSWF,inWidth,inHeight)
{
	document.write("\r\
	<OBJECT codeBase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" height=\""+inHeight+"\" width=\""+inWidth+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\">\r\
	<PARAM NAME=\"Movie\" VALUE=\""+inSWF+"\">\r\
	<PARAM NAME=\"Src\" VALUE=\""+inSWF+"\">\r\
	<PARAM NAME=\"WMode\" VALUE=\"Transparent\">\r\
	<embed src=\""+inSWF+"\" quality=\"high\" allowscriptaccess=\"always\" wmode=\"Transparent\" type=\"application/x-shockwave-flash\"  pluginspage=\"http://www.macromedia.com/go/getflashplayer\" height=\""+inHeight+"\" width=\""+inWidth+"\">\r\
	</OBJECT>");
}

//检测表单
function $N(Name){return document.getElementsByName(Name)}

function $CheckForm(){
	var Name=$N("p_item");
	var M=0;//选中的记录数
	for (i=0;i<Name.length;i++){
		if(Name[i].checked)M++;
	}
	if(M<1){
		alert("请选择您要购买的产品");
		 return false;
	}
}

function $CheckOther(id,Name,M){
	if(M==1){
	if(id.checked){
		for(n=0;n<$N(Name).length;n++){
			$N(Name)[n].checked="";
		}
		id.checked="checked";
	}
	}else{
		if($N(Name)[$N(Name).length-1].value.split("$")[2]!="0")$N(Name)[$N(Name).length-1].checked="";}
}

function $LinkChecked(xID,xName,oN){
		if(!xID.checked){
			$N(xName)[oN].checked="";
			$N(xName)[oN].disabled="disabled";
		}else{
			$N(xName)[oN].disabled="";
		}
}


var $uKeFu; var $uTop = 0; var $uOldTop = $uTop; 
function $initFloatTips() { 
	if(document.getElementById("uKeFu")){
	$uKeFu = document.getElementById("uKeFu"); 
	$uTop=Number(document.getElementById('uKeFu').getAttributeNode("uTop").value);
	$uMoveTips(); 
	$("#uKeFu").show();
}; 
function $uMoveTips() { 
	var $uT=1; 
	var $uPos;
	if (window.innerHeight) { 
		$uPos = window.pageYOffset 
	} 
	else if (document.documentElement && document.documentElement.scrollTop) { 
		$uPos = document.documentElement.scrollTop 
	} 
	else if (document.body) { 
		$uPos = document.body.scrollTop; 
	} 
	$uPos=$uPos-$uKeFu.offsetTop+$uTop-80; 
	$uPos=$uKeFu.offsetTop+$uPos/10; 
	if ($uPos < $uTop) $uPos = $uTop; 
	if ($uPos != $uOldTop) { 
		$uKeFu.style.top = $uPos+"px"; 
		$uT=1; 
	} 
	$uOldTop = $uPos; 
	setTimeout($uMoveTips,$uT);
	}
}
function $Price()
{
	var Price=0;
	var OfferCase="";
	var SuppliersPrice=0;
	var SuppliersNumber=0;
	$("#Offer_Other").hide();
	$("input[name=PriceItem]").each(
		function(i){
			if(i==0)$(this).attr("checked",true);
			if($(this).attr("checked")==true)
			{
				var myVal=$(this).val().split('|');
				if(Number(myVal[0])==365)
				{
					SuppliersPrice=365;
					SuppliersNumber=2;
				}
				else
				{
					Price+=Number(myVal[0]);
					OfferCase+=myVal[1];
				}
			}
		})
		Price+=SuppliersPrice;
	$("#PriceA").html(Price);
	switch(OfferCase)
	{
		case "0":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("50");
			$("#Offer_Count").html(Number("5")+SuppliersNumber);
			break;
		case "01":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("100");
			$("#Offer_Count").html(Number("5")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "011":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("150");
			$("#Offer_Count").html(Number("10")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "0111":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("200");
			$("#Offer_Count").html(Number("15")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "012":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("100");
			$("#Offer_Count").html(Number("5")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "0112":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("150");
			$("#Offer_Count").html(Number("10")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "02":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("50");
			$("#Offer_Count").html(Number("5")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "022":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("50");
			$("#Offer_Count").html(Number("5")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "01112":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("200");
			$("#Offer_Count").html(Number("20")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "011122":
			$("#PriceB").html(Number("3650")+SuppliersPrice);
			$("#Offer_Host").html("200");
			$("#Offer_Count").html(Number("30")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "0122":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("100");
			$("#Offer_Count").html(Number("10")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		case "01122":
			$("#PriceB").html(Price);
			$("#Offer_Host").html("150");
			$("#Offer_Count").html(Number("15")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
			
		case "0111222":
			$("#PriceB").html("3650");
			$("#Offer_Host").html("200");
			$("#Offer_Count").html(Number("30")+SuppliersNumber);
			$("#Offer_Other").show();
			break;
		
	}
}

