﻿// JavaScript Document
function $(id){
	return (document.getElementById) ? document.getElementById(id) : document.all[id] ; 
} 
// --- 设置cookie
function setCookie(sName,sValue,expireHours) {
	var cookieString = sName + "=" + escape(sValue);
	//;判断是否设置过期时间
	if (expireHours>0) {
		var date = new Date();
		date.setTime(date.getTime + expireHours * 3600 * 1000);
		cookieString = cookieString + "; expire=" + date.toGMTString();
	}
	document.cookie = cookieString;
}
//--- 获取cookie
function getCookie(sName) {
	var aCookie = document.cookie.split("; ");
	for (var j=0; j < aCookie.length; j++){
		var aCrumb = aCookie[j].split("=");
		if (escape(sName) == aCrumb[0])
		return unescape(aCrumb[1]);
	}
	return null;
}

// “显示”和“隐藏”
function show(strtype){document.getElementById(strtype).style.display = 'block';}
function hide(strtype){document.getElementById(strtype).style.display = 'none';}

/* 交替 */
//头
function setPos(source,obj){
	var objvar=document.getElementById(obj);
	oRect=source.getBoundingClientRect();
	objvar.style.left=oRect.left;
	objvar.style.top=oRect.top+24;
}

function VideoSubNav()
{	show('VideoSubNav');
}
function VideoSubNavHide()
{	hide('VideoSubNav');
}

function ProductSubNav()
{	show('ProductSubNav');
}
function ProductSubNavHide()
{	hide('ProductSubNav');
}

function SolutionSubNav()
{	show('SolutionSubNav');
}
function SolutionSubNavHide()
{	hide('SolutionSubNav');
}

function TechnologySubNav()
{	show('TechnologySubNav');
}
function TechnologySubNavHide()
{	hide('TechnologySubNav');
}

function InformationSubNav()
{	show('InformationSubNav');
}
function InformationSubNavHide()
{	hide('InformationSubNav');
}

function ServiceSubNav()
{	show('ServiceSubNav');
}
function ServiceSubNavHide()
{	hide('ServiceSubNav');
}


function SubLabelLink()
{
	document.getElementById('SubLabel1').className="SubLabel-current";
}

function active(obj,style){
	obj.className=style;
}

//2级子菜单
function showorhide(icon,border)
{
	if(document.getElementById(border).style.display !== 'none')
	{
		document.getElementById(icon).className="Prolef-Nav-Category-icondown";
		document.getElementById(border).style.display = 'none';
	}
	else
	{
		document.getElementById(icon).className="Prolef-Nav-Category-icon";
		document.getElementById(border).style.display = '';
	}
}

function ProductRigrange()
{
	document.getElementById('ProductRigrange').className="ProductRig-detailmore-label-current align white";
	document.getElementById('ProductRiguseSet').className="ProductRig-detailmore-label align";
	document.getElementById('ProductRigfunction').className="ProductRig-detailmore-label align";
	document.getElementById('ProductRigFeature').className="ProductRig-detailmore-label align";
	show('ProductRigrangeDetail');
	hide('ProductRiguseSetDetail');
	hide('ProductRigfunctionDetail');
	hide('ProductRigFeatureDetail');
}

function ProductRiguseSet()
{ 
	document.getElementById('ProductRigrange').className="ProductRig-detailmore-label align";
	document.getElementById('ProductRiguseSet').className="ProductRig-detailmore-label-current align white";
	document.getElementById('ProductRigfunction').className="ProductRig-detailmore-label align";
	document.getElementById('ProductRigFeature').className="ProductRig-detailmore-label align";
	hide('ProductRigrangeDetail');
	show('ProductRiguseSetDetail');
	hide('ProductRigfunctionDetail');
	hide('ProductRigFeatureDetail');
}

function ProductRigfunction()
{
	document.getElementById('ProductRigrange').className="ProductRig-detailmore-label align";
	document.getElementById('ProductRiguseSet').className="ProductRig-detailmore-label align";
	document.getElementById('ProductRigfunction').className="ProductRig-detailmore-label-current align white";
	document.getElementById('ProductRigFeature').className="ProductRig-detailmore-label align";
	hide('ProductRigrangeDetail');
	hide('ProductRiguseSetDetail');
	show('ProductRigfunctionDetail');
	hide('ProductRigFeatureDetail');
}

function ProductRigFeature()
{
	document.getElementById('ProductRigrange').className="ProductRig-detailmore-label align";
	document.getElementById('ProductRiguseSet').className="ProductRig-detailmore-label align";
	document.getElementById('ProductRigfunction').className="ProductRig-detailmore-label align";
	document.getElementById('ProductRigFeature').className="ProductRig-detailmore-label-current align white";
	hide('ProductRigrangeDetail');
	hide('ProductRiguseSetDetail');
	hide('ProductRigfunctionDetail');
	show ('ProductRigFeatureDetail');
}


//视频分类公用函数开始
function ClassAll(){
	document.getElementById('Intrusion').className="color floatR function-span padding5 cursor";
	document.getElementById('ItemMove').className="color floatR function-span padding5 cursor";
	document.getElementById('Abandonment').className="color floatR function-span padding5 cursor";
	document.getElementById('IllegalPark').className="color floatR function-span padding5 cursor";
	document.getElementById('PTZTrack').className="color floatR function-span padding5 cursor";
	document.getElementById('Wander').className="color floatR function-span padding5 cursor";
	document.getElementById('TelayTrack').className="color floatR function-span padding5 cursor";
	document.getElementById('PIP').className="color floatR function-span padding5 cursor";
	document.getElementById('WideDynamic').className="color floatR function-span padding5 cursor";
	document.getElementById('firework').className="color floatR function-span padding5 cursor";
	document.getElementById('anti-jamming').className="color floatR function-span padding5 cursor";
	document.getElementById('UnusualVideo').className="color floatR function-span padding5 cursor";
}

function HideAll(){
	hide('IntrusionSub');
	hide('ItemMoveSub');
	hide('AbandonmentSub');
	hide('IllegalParkSub');
	hide('PTZTrackSub');
	hide('WanderSub');
	hide('TelayTrackSub');
	hide('PIPSub');
	hide('WideDynamicSub');
	hide('fireworkSub');
	hide('anti-jammingSub');
	hide('UnusualVideoSub');
}
//视频分类公用函数结束

function Intrusion(){
	ClassAll();
	document.getElementById('Intrusion').className="floatR function-span red bold padding5 cursor";
  
	HideAll();
	show('IntrusionSub');
}

function PTZTrack(){
	ClassAll();
	document.getElementById('PTZTrack').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('PTZTrackSub');
}

function TelayTrack(){
	ClassAll();
	document.getElementById('TelayTrack').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('TelayTrackSub');
}

function PIP(){
	ClassAll();
	document.getElementById('PIP').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('PIPSub');
}


function WideDynamic(){
	ClassAll();
	document.getElementById('WideDynamic').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('WideDynamicSub');
}

function ItemMove(){
	ClassAll();
	document.getElementById('ItemMove').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('ItemMoveSub');
}

function Abandonment(){ 
	ClassAll();
	document.getElementById('Abandonment').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('AbandonmentSub');
}

function IllegalPark(){ 
	ClassAll();
	document.getElementById('IllegalPark').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('IllegalParkSub');
}

function Wander(){ 
	ClassAll();
	document.getElementById('Wander').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('WanderSub');
}
	
function firework(){
	ClassAll();
	document.getElementById('firework').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('fireworkSub');
}

function antijamming(){ 
	ClassAll();
	document.getElementById('anti-jamming').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('anti-jammingSub');
}
	
function UnusualVideo(){
	ClassAll();
	document.getElementById('UnusualVideo').className="floatR function-span red bold padding5 cursor";
	
	HideAll();
	show('UnusualVideoSub');
}

//******************播放层开始
function VideoMainPlay(s,obj)
{   
	var solutionX=window.screen.width
	var solutionY=window.screen.height
	var videoWidth=540
	var videoHeight=480
	if(solutionY<=650) {
		videoWidth=405;videoHeight=360;
		VideoMainLayer.style.width=408;
		VideoMainLayer.style.height=387;
	}
   var str="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + videoWidth + "' height='" + videoHeight + "'><param name='movie' value='" + s + "' /><param name='quality' value='high' /><embed src='" + s + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + videoWidth + "' height='" + videoHeight + "'></embed></object>"; 
   VideoMainContext.innerHTML=str;
   setLayerPos(obj);
}

function setLayerPos(obj){	
	var top=getTop(obj)
	var allh=document.body.scrollHeight
	var test=event.clientY
	if(test>80) top=top - test+50
	if(test<20) top=top + test+20
	VideoMainLayer.style.left=window.screen.width /2-300
	VideoMainLayer.style.top=top
	
	var temp_h1 = document.body.clientHeight;
	var temp_h2 = document.documentElement.clientHeight;
	var isXhtml = (temp_h2<=temp_h1&&temp_h2!=0)?true:false; 
	var htmlbody = isXhtml?document.documentElement:document.body;
	htmlbody.style.overflow = "hidden";	
	
	maskLayer.style.width=window.screen.width //document.body.scrollWidth
	maskLayer.style.height=document.body.scrollHeight
	show('VideoMainLayer');
	show('maskLayer');
}
function hiddenVideoLayer(){
	hide('maskLayer');
	hide('VideoMainLayer');
	var temp_h1 = document.body.clientHeight;
	var temp_h2 = document.documentElement.clientHeight;
	var isXhtml = (temp_h2<=temp_h1&&temp_h2!=0)?true:false; 
	var htmlbody = isXhtml?document.documentElement:document.body;
	htmlbody.style.overflow = "auto";
}
//获取元素的纵坐标 
function getTop(e){ 
	var offset=e.offsetTop; 
	if(e.offsetParent!=null) offset+=getTop(e.offsetParent); 
	return offset; 
} 

//******************播放层结束


function intelligentLabel1()
{
	document.getElementById('intelligentLabel1').className="centerLeFrame2-up-right-current";
	document.getElementById('intelligentLabel2').className="centerLeFrame2-up-right-label1 blue";
	document.getElementById('intelligentLabel3').className="centerLeFrame2-up-right-label1 blue";
	
	show('intelligent1');
	hide('intelligent2');
	hide('intelligent3');
}
	
function intelligentLabel2()
{
	document.getElementById('intelligentLabel1').className="centerLeFrame2-up-right-label1 blue";
	document.getElementById('intelligentLabel2').className="centerLeFrame2-up-right-current";
	document.getElementById('intelligentLabel3').className="centerLeFrame2-up-right-label1 blue";
	
	show('intelligent2');
	hide('intelligent1');
	hide('intelligent3');
}
	
function intelligentLabel3()
{
	document.getElementById('intelligentLabel1').className="centerLeFrame2-up-right-label1 blue";
	document.getElementById('intelligentLabel2').className="centerLeFrame2-up-right-label1 blue";
	document.getElementById('intelligentLabel3').className="centerLeFrame2-up-right-current"; 
	
	show('intelligent3');
	hide('intelligent1');
	hide('intelligent2');
}

function news()
{
	document.getElementById('1').className="MainRedTopNews-left font12 white";
	document.getElementById('2').className="MainRedTopNewsW-left font12 bold red";
	document.getElementById('3').className="MainRedTopNewsW-left font12 bold red";
	
	show('news');
	hide('topic');
	hide('focus');
}
	
function topic()
{
	document.getElementById('1').className="MainRedTopNewsW-left font12 bold red";
	document.getElementById('2').className="MainRedTopNews-left font12 white";
	document.getElementById('3').className="MainRedTopNewsW-left font12 bold red";
	
	hide('news');
	show('topic');
	hide('focus');
}

function Focus()
{
	document.getElementById('1').className="MainRedTopNewsW-left font12 bold red";
	document.getElementById('2').className="MainRedTopNewsW-left font12 bold red";
	document.getElementById('3').className="MainRedTopNews-left font12 white"; 
	
	hide('news');
	hide('topic');
	show('focus');
}

