<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function FP_openNewWindow(w,h,nav,loc,sts,menu,scroll,resize,name,url) {//v1.0
 var windowProperties=''; if(nav==false) windowProperties+='toolbar=no,'; else
  windowProperties+='toolbar=yes,'; if(loc==false) windowProperties+='location=no,'; 
 else windowProperties+='location=yes,'; if(sts==false) windowProperties+='status=no,';
 else windowProperties+='status=yes,'; if(menu==false) windowProperties+='menubar=no,';
 else windowProperties+='menubar=yes,'; if(scroll==false) windowProperties+='scrollbars=no,';
 else windowProperties+='scrollbars=yes,'; if(resize==false) windowProperties+='resizable=no,';
 else windowProperties+='resizable=yes,'; if(w!="") windowProperties+='width='+w+',';
 if(h!="") windowProperties+='height='+h; if(windowProperties!="") { 
  if( windowProperties.charAt(windowProperties.length-1)==',') 
   windowProperties=windowProperties.substring(0,windowProperties.length-1); } 
 window.open(url,name,windowProperties);
}

function OpWin(UrlStr){
FP_openNewWindow('', '', false, false, false, false, true, true, 'Flash', /*href*/''+UrlStr)
}

function checkRate(str)
{
     var re = /^[0-9]+.?[0-9]*$/;   //判断字符串是否为数字/^[0-9]+.?[0-9]*$/     //判断正整数 /^[1-9]+[0-9]*]*$/   
     if (!re.test(str)) {
        return false;
    } else {
		return true;
	}
}

var Cookie= {
        Set : function (){
                var name = arguments[0], value = escape(arguments[1]),
                days = (arguments.length > 2)?arguments[2]:365,
                path = (arguments.length > 3)?arguments[3]:"/";
                with(new Date()){
                        setDate(getDate()+days);
                        days=toUTCString();
                }
                document.cookie = "{0}={1};expires={2};path={3}".format(name, value, days, path);
        },
        Get : function (){
                var returnValue=document.cookie.match(new RegExp("[\b\^;]?" + arguments[0] + "=([^;]*)(?=;|\b|$)","i"));
                return returnValue?unescape(returnValue[1]):returnValue;
        },
        Delete : function (){
                var name=arguments[0];
                document.cookie = name + "=1 ; expires=Fri, 31 Dec 1900 23:59:59 GMT;";
        }
}

//JS等比缩略图 //示例使用：onload="DrawImage(this,120,90);"
function DrawImage(ImgD,iw,ih){
    var image=new Image();
    var iwidth = iw; //定义允许宽度，当宽度大于这个值时等比例缩小
    var iheight = ih; //定义允许高度，当高度大于这个值时等比例缩小
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
        flag=true;
        if(image.width/image.height>= iwidth/iheight){
            if(image.width>iwidth){
                ImgD.width=iwidth;
                ImgD.height=(image.height*iwidth)/image.width;
            }else{
                ImgD.width=image.width;
                ImgD.height=image.height;
            }
        }else{
            if(image.height>iheight){
                ImgD.height=iheight;
                ImgD.width=(image.width*iheight)/image.height;
            }else{
                ImgD.width=image.width;
                ImgD.height=image.height;
            }
        }
    }
}

//JS等比缩略图2 使用示例：onload="Resize(this,'50,50');"
function Resize(drawImage,thumbs_size) {
    var max = thumbs_size.split(',');
    var fixwidth = max[0];
    var fixheight = max[1];
    w=drawImage.width;h=drawImage.height;
    if(w>fixwidth) { drawImage.width=fixwidth;drawImage.height=h/(w/fixwidth);}    
    if(h>fixheight) { drawImage.height=fixheight;drawImage.width=w/(h/fixheight);}          
    drawImage.style.cursor= "pointer";    
    //drawImage.onclick = function() { window.open(this.src);}     
    //drawImage.title = "点击查看原始图片";   
}

//JS等比缩图（裁剪）使用示例：onload="Zoom(this,120,90);"
function Zoom(obj, width, height){
    var img = new Image();
    img.src = obj.src;
    var scale = Math.max(width / img.width, height / img.height);
    var newWidth = img.width * scale;
    var newHeight = img.height * scale;
    var div = obj.parentNode;

    obj.width = newWidth;
    obj.height = newHeight;
    div.style.width = width + "px";
    div.style.height = height + "px";
    div.style.overflow = "hidden";
    obj.style.marginLeft = (width - newWidth) / 2 + "px";
    obj.style.marginTop = (height - newHeight) / 2 + "px";
}


function request(paras){ 
var url = location.href;   
var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");   
var paraObj = {}   
for (i=0; j=paraString[i]; i++){   
paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf 
("=")+1,j.length);   
}   
var returnValue = paraObj[paras.toLowerCase()];   
if(typeof(returnValue)=="undefined"){   
return "";   
}else{   
return returnValue;   
}   
} 
var theurl 
theurl=request("url"); 
if (theurl!=''){ 
location=theurl 
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    } else {
        return document[movieName];
    }
}

function getCurrentUrlJstoFla() {
//alert(window.location.href.replace('\&','^'));
//alert(location.search.substr(1));
ChangeLang(Cookie.Get("DigitalVvxTLanguage"));
//thisMovie('Top_menu').SetVariable("Lang.currentUrl", window.location.href.replace('\&','^'));
}

function regInput(obj, reg, inputStr)
{
var docSel = document.selection.createRange()
if (docSel.parentElement().tagName != "INPUT") return false
oSel = docSel.duplicate()
oSel.text = ""
var srcRange = obj.createTextRange()
oSel.setEndPoint("StartToStart", srcRange)
var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
return reg.test(str)
}

function checkEmail(xstr,sid)
{
     var emailtest=/^[0-9a-z][_.0-9a-z-]{0,31}@([0-9a-z][0-9a-z-]{0,30}[0-9a-z]\.){1,4}[a-z]{2,4}$/i;
     if(emailtest.test(xstr)) {
		 return true;
     } else {
		 $("#"+sid).focus();
		 setbg("#"+sid);
		 return false;
     }
	 
	 return false;
}

function checkRate(xstr,sid)
{
     var ratetest=/^[0-9]*[1-9][0-9]*$/i;
     if(ratetest.test(xstr)) {
		 return true;
     } else {
		 $("#"+sid).focus();
		 setbg("#"+sid);
		 return false;
     }
	 
	 return false;
}

function setbg(oid){
   $(oid).css('background-image','url(images/input_bg.jpg)');
   $(oid).css('backgroundPosition','0px -6px');
   $(oid).css('backgroundRepeat','repeat-x'); 
}

//JS Trim
String.prototype.Trim = function(){return Trim(this);}
String.prototype.LTrim = function(){return LTrim(this);}
String.prototype.RTrim = function(){return RTrim(this);}

function LTrim(str)
{
    var i;
    for(i=0;i<str.length;i++)
    {
        if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break;
    }
    str=str.substring(i,str.length);
    return str;
}
function RTrim(str)
{
    var i;
    for(i=str.length-1;i>=0;i--)
    {
        if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break;
    }
    str=str.substring(0,i+1);
    return str;
}
function Trim(str)
{
    return LTrim(RTrim(str));
}



function ChangeLang(strLang) {	
	if(strLang == "cn") {
		lang = "en";
	} else {
		lang = "cn";
	}
	//thisMovie('Top_menu').SetVariable("Lang.currentLang", lang);
	//thisMovie('Top_menu').SetVariable("Lang.currentUrl", window.location.href.replace('\&','^'));
}

//PNG图片控制
$(function() {
	//$(document).pngFix(); 
});
//
////导航控制
$(function() {
	//左边导航列表控制
var tempdocUrl = document.URL;   
var templastPipe = parseInt(tempdocUrl.lastIndexOf('/')+1);
var temptypes = tempdocUrl.substring(templastPipe);
if(temptypes.indexOf("#")) {
	var tempsp = temptypes.split("#");
	temptypes = tempsp[0];
}
if(temptypes.indexOf("&")) {
	var tempsp = temptypes.split("&");
	temptypes = tempsp[0];
}
temptypes = temptypes.toLowerCase();
if (temptypes.indexOf("?") == -1) {
	temptypes = "";
}  
    var fileName=temptypes;
	
	$(".siderlist li").find("a").each(function() {
		var name = $(this).attr("href").toLowerCase();
		//alert(name);
		if(fileName == name){
			$(this).css("background-color",'#d1e4a4');
		}
	}); 
	
	//主导航控制
	var docUrl = document.URL;   
    var lastPipe = docUrl.lastIndexOf('/');   
    var lastPeriod = docUrl.lastIndexOf('.') + 4;   
    var fileName;
    if (lastPipe < lastPeriod) {
        fileName = docUrl.substring(lastPipe + 1, lastPeriod);   
	}
    //fileName.replace(/\b\w+\b/g, function(word){return word.substring(0,1).toLowerCase() +word.substring(1);});	
	if(request("id") != "") {	fileName += "?id=" + request("id");	}
	fileName = fileName.toLowerCase();
    //alert(fileName);
	
	$("#nav li").find("a").each(function(j) {
		var name = $(this).attr("href").toLowerCase();
		//特殊处理
		var Special_idStr = new Array();
		var s_name;
		var Special_name = "about.asp?id=51";
		Special_idStr.push("?id=51","?id=50","?id=52","?id=53");
		
		if(fileName.indexOf("search.asp") != -1) {s_name = "products.asp";}//独立处理
		var i;
		var isSet = false;
		var k;
		
		for(i in Special_idStr) {
			
			if(fileName.indexOf(Special_name + Special_idStr[i]) != -1) {s_name = Special_name + Special_idStr[i];}

			//alert(fileName + " | " + name);
			//alert(name.substring(0,name.lastIndexOf(".")));
		
			if(s_name != undefined && fileName.indexOf(Special_name + Special_idStr[i]) != -1) {
				if($(this).attr("href").toLowerCase() == Special_name + Special_idStr[i]) {
					//alert(j);
					SetHover(this);
					//alert(isSet);
					break;
				}
			} else if(fileName.indexOf(name.substring(0,name.lastIndexOf("."))) != -1) {
				//alert(j);
				if(fileName.indexOf(Special_name) != -1) {
					if($(this).attr("href").toLowerCase() == Special_name) {
						//alert(j);					
						for(k in Special_idStr) {
							if(fileName == Special_name + Special_idStr[k]) {
								//alert(fileName + " | " + Special_name + Special_idStr[k]);
								isSet = true;
							}						
						}
						if(!isSet) {
							SetHover(this);
						}
					}
				} else {
					SetHover(this);
				}
			}
		
			if(name.indexOf(s_name) != -1 ) {
				SetHover(this);
			}	
			//alert(name);
		 
		} 
	});	
	
	function SetHover(obj) {
		$(obj).addClass({'color':'#f4e9c9'});
	}

});


//首页flash判断
function checkIndex() {
var ishome = false;
if(window.location.href.substring(parseInt(window.location.href.lastIndexOf('/')+1),window.location.href.length).toLowerCase().indexOf('home.asp') != -1 || window.location.href.substring(parseInt(window.location.href.lastIndexOf('/')),window.location.href.length).toLowerCase() == "/" || window.location.href.substring(parseInt(window.location.href.lastIndexOf('/')),window.location.href.length).toLowerCase().indexOf('/?') != -1) {
    ishome = true;
}

return ishome;
}

