﻿
var waitting = 1;
var secondLeft = waitting;
var timer;
var sourceObj;
var number;
function getObject(objectId)//获取id的函数               
{
    if (document.getElementById && document.getElementById(objectId)) {
        // W3C DOM              
        return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
        // MSIE 4 DOM              
        return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
        // NN 4 DOM.. note: this won't find nested layers              
        return document.layers[objectId];
    } else {
        return false;
    }
}
function SetTimer()//主导航时间延迟的函数              
{
    for (j = 1; j < 10; j++) {
        if (j == number) {
            if (getObject("mm" + j) != false) {
                getObject("mm" + number).className = "menuhover";
                getObject("mb" + number).className = "";
            }
        }
        else {
            if (getObject("mm" + j) != false) {
                getObject("mm" + j).className = "";
                getObject("mb" + j).className = "hide";
            }
        }
    }
}
function ContentSize(size)
{
	var content = document.getElementById('content');
		if(!content){
			return;
		}
		var contentChild = content.childNodes;
		content.style.fontSize = size + 'px';
		for(var i = 0; i < contentChild.length; i++){
			if(contentChild[i].nodeType == 1){
				contentChild[i].style.fontSize = size + 'px';
			}
		}
 }
function CheckTime()//设置时间延迟后              
{
    secondLeft--;
    if (secondLeft == 0) {
        clearInterval(timer);
        SetTimer();
    }
}
function showM(thisobj, Num)//主导航鼠标滑过函数,带时间延迟
{
    if (Num == 4) { $('#mainmenu_bottom').hide();$('#bottomhg').show(); }
    else{$('#mainmenu_bottom').show();
    $('#bottomhg').hide();}
    number = Num;
    sourceObj = thisobj;
    secondLeft = 1;
    timer = setTimeout('CheckTime()', 100);
}
function showMEn(thisobj, Num)//主导航鼠标滑过函数,带时间延迟
{
    $('#mainmenu_bottom').show();
    $('#bottomhg').hide();
    //if (Num == 4) { $('#mainmenu_bottom').hide();}
    number = Num;
    sourceObj = thisobj;
    secondLeft = 1;
    timer = setTimeout('CheckTime()', 100);
}
function OnMouseLeft()//主导航鼠标移出函数,清除时间函数
{
    clearInterval(timer);
}
var timeout         = 500;
var closetimer		= 100;
var ddmenuitem      = 0;
function jsddm_open()
{	
$(this).addClass('tm');
jsddm_canceltimer();
	jsddm_close();
	ddmenuitem = $(this).find('ul').eq(0).show();}

function jsddm_close()
{	if(ddmenuitem) ddmenuitem.hide();}

function jsddm_timer()
{	closetimer = window.setTimeout(jsddm_close, timeout);$(this).removeClass('tm')}

function jsddm_canceltimer()
{	if(closetimer)
	{	window.clearTimeout(closetimer);
		closetimer = null;}
}
function changeDisplay(divid){   
                var briefDiv = $("#briefDiv"+divid);  
                var contentDiv = $("#contentDiv"+divid);   
                if(contentDiv.is(":hidden")){  
                    briefDiv.hide();  
					contentDiv.show();
                }else{   
                     briefDiv.show();  
					 contentDiv.hide();   
                }                     
    }
    $(document).ready(function() {
//        $('.topnav > li').bind('mouseover', jsddm_open);
//        $('.topnav > li').bind('mouseout', jsddm_timer);
	$('#webmenu li').hover(function(){
		$(this).children('ul').stop(true,true).show('fast');
	},function(){
		$(this).children('ul').stop(true,true).hide('slow');
	});
	
	$('#webmenu li').hover(function(){
		$(this).children('div').stop(true,true).show('fast');
	},function(){
		$(this).children('div').stop(true,true).hide('slow');
	});
        //	var userAgent = navigator.userAgent.toLowerCase(); 
        //	var Sys = {};
        //        var ua = navigator.userAgent.toLowerCase();
        //        var s;
        //         (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
        //         (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
        //         (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
        //         (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
        //         (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
        //if(Sys.ie=='8.0')
        //{
        //$(".top_menu").css('margin-left','16px');
        //}
        //if(Sys.firefox)
        //{
        //$(".top_menu").css('margin-left','14px');
        //}
        $(".dpen").hover(function() {
        $(this).find(".topnavli").show();
        },
        function () {
        $(this).find(".topnavli").hide();
        });
        var $firstck = 0;
        var $div_a = $(".dvnav > a");
        var $thismu = $(".pnlist > div").eq($firstck);
        var $pul = $('.pul');
        var $ppli = $('.ppli');
        var $navlefttlli = $('.navlefttl ul li');
        $thismu.show().siblings().hide();
        var $pplih2 = $('.ppli h2');
        var $div_a_w=968/$div_a.length;
        $div_a.css('width',$div_a_w);
        $div_a.click(function() {
            $(this).addClass('ppplimov').siblings().removeClass("ppplimov");
            var index = $div_a.index(this);
            $(".pnlist > div").eq(index).show("slow").siblings().hide("slow");
            $firstck = index;
        });
        $pul.hover(function() {
            //$(this).addClass('ulline');
            $(this).prev('h2').children('a').removeClass().addClass('ptnhouse');
            $(this).find('a').css('color', '#293439');
        }, function() {
            //$(this).removeClass('ulline');
            $(this).prev('h2').children('a').removeClass().addClass('ptn');
            $(this).find('a').css('color', '#6C6C6C');
        });
        $ppli.hover(function() {
            $(this).addClass('pplibg');
        }, function() {
            $(this).removeClass('pplibg');
        });
        $pplih2.hover(function() {
            $(this).find('a').addClass('ptnhouse');
        }, function() {
            $(this).find('a').removeClass('ptnhouse').addClass('ptn');
        });
        var x = 10;
        var y = 10;
        var $piclistsls = $('.piclists .piclistsls .lsimg');
        //            alert($piclistsls.eq(0).find('img').attr('src'));
        $piclistsls.mouseover(function(e) {
            var index = $piclistsls.index(this);
            var $tooltip = "<div id='tooltip'><img src='" + $piclistsls.eq(index).find('img').attr('src') + "'  width='280' height='200'/>" + "<\/div>";
            $("body").append($tooltip);
            $("#tooltip")
			.css({
			    "top": (e.pageY + y) + "px",
			    "left": (e.pageX + x) + "px"
			}).show("fast");
        }).mouseout(function() {
            //		this.title = this.myTitle;	
            $("#tooltip").remove();
        }).mousemove(function(e) {
            $("#tooltip")
			.css({
			    "top": (e.pageY + y) + "px",
			    "left": (e.pageX + x) + "px"
			});
        });
        var $clickfirst = 0;
        $navlefttlli.click(function() {
        //$(this).addClass('tlbgsel').siblings().removeClass('tlbgsel');
        $(this).removeClass('tlbgnosel');
        $(this).addClass('tlbgsel').siblings().removeClass('tlbgsel').addClass('tlbgnosel');
            var index = $navlefttlli.index(this);
            $clickfirst = index;
            $('#left2 .tlnav').eq(index).show('slow').siblings().hide('slow');
        });
    });
document.onclick = jsddm_close;
