﻿//more javascript from <a href="http://www.baist.net" target="_blank">http://www.baist.net</a> 
var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds) 
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d) 
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no) 

/////No further editting needed 

var ie5=document.all 
var ns6=document.getElementById&&!document.all 

function getposOffset(what, offsettype){ 
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; 
var parentEl=what.offsetParent; 
while (parentEl!=null){ 
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; 
parentEl=parentEl.offsetParent; 
} 
return totaloffset; 
} 

function showhide(obj, e, visible, hidden){ 
if (ie5||ns6) 
dropmenuobj.style.left=dropmenuobj.style.top=-500 
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover") 
obj.visibility=visible 
else if (e.type=="click") 
obj.visibility=hidden 
} 

function iecompattest(){ 
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body 
} 

function clearbrowseredge(obj, whichedge){ 
var edgeoffset=0 
if (whichedge=="rightedge"){ 
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15 
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth 
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) 
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth 
} 
else{ 
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18 
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight 
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) 
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight 
} 
return edgeoffset 
} 

function dropdownmenu(obj, e, dropmenuID){ 
if (window.event) event.cancelBubble=true 
else if (e.stopPropagation) e.stopPropagation() 
if (typeof dropmenuobj!="undefined") //hide previous menu 
dropmenuobj.style.visibility="hidden" 
clearhidemenu() 
if (ie5||ns6){ 
obj.onmouseout=delayhidemenu 
dropmenuobj=document.getElementById(dropmenuID) 
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'} 
dropmenuobj.onmouseover=clearhidemenu 
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)} 
showhide(dropmenuobj.style, e, "visible", "hidden") 
dropmenuobj.x=getposOffset(obj, "left") 
dropmenuobj.y=getposOffset(obj, "top") 
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px" 
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px" 
} 
return clickreturnvalue() 
} 

function clickreturnvalue(){ 
if ((ie5||ns6) && !enableanchorlink) return false 
else return true 
} 

function contains_ns6(a, b) { 
while (b.parentNode) 
if ((b = b.parentNode) == a) 
return true; 
return false; 
} 

function dynamichide(e){ 
if (ie5&&!dropmenuobj.contains(e.toElement)) 
delayhidemenu() 
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget)) 
delayhidemenu() 
} 

function delayhidemenu(){ 
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay) 
} 

function clearhidemenu(){ 
if (typeof delayhide!="undefined") 
clearTimeout(delayhide) 
} 

//PopWindow
$(document).ready(
	function()
	{
		$('#windowOpen').bind(
			'click',
			function() {
				if($('#window').css('display') == 'none') {
					$(this).TransferTo(
						{
							to:'window',
							className:'transferer2', 
							duration: 400,
							complete: function()
							{
								$('#window').show();
							}
						}
					);
				}
				this.blur();
				return false;
			}
		);
		$('#windowClose').bind(
			'click',
			function()
			{
				$('#window').TransferTo(
					{
						to:'windowOpen',
						className:'transferer2', 
						duration: 400
					}
				).hide();
			}
		);	
		$('#window').Resizable(
			{
				dragHandle: '#windowTop',
				handlers: {
					se: '#windowResize'
				},
				onResize : function(size, position) {
					$('#windowBottom, #windowBottomContent').css('height', size.height-33 + 'px');
					var windowContentEl = $('#windowContent').css('width', size.width - 25 + 'px');
					if (!document.getElementById('window').isMinimized) {
						windowContentEl.css('height', size.height - 48 + 'px');
					}
				}
			}
		);
	
	}
);

//Extended
function actMenu(menuid)
{
try
        {
        var menuidobj = document.getElementById(menuid)
        if(menuidobj.style.display=='none')
        {
                try
                {        
                        menu1.style.display='none';
                        menu2.style.display='none';
                }
                catch(e)
                {}        
                
                menuidobj.style.display='';
                Set(menuid);
                menucookie = menuid;
        }
        else
        {
                menuidobj.style.display='none';
                Set("none");
        }
        }
catch(e)
{}        
}

//TabControl
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 openwin() { 
window.open ("infomation.html", "Infomation or Quote Request Form", "height=800, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") 
} 

function livehelp() { 
window.open ('livehelp.html', 'Form', 'height=135, width=400, top=384, left=512, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
} 
