﻿//---------------------网站域名列表设置开始---------------------------------
var __WebsiteDomain;
__WebsiteDomain=[[0,"www.cgmgc.com"],[0,"www.cgmgc.cn"],[0,"www.chinachaosu.com"],[1,"bj.cgmgc.com"]]
//---------------------网站域名列表设置结束---------------------------------

//--------------------检查表单字段长度基本函数----------------------
function CheckValueBy(strFormName,strFieldName,strMessage,strCompare,intLen)
{  var objField;
   var objFieldValue;
   var objFieldValueLen;
   objField=eval(strFormName+"."+strFieldName);
   objFieldValue=eval(strFormName+"."+strFieldName+".value");
   objFieldValueLen=eval(strFormName+"."+strFieldName+".value.length");
   if (eval(objFieldValueLen+strCompare+intLen))
   {
      alert(strMessage);
	  objField.focus();
	  return true;
   }
   else
   {return false;}
}
//--------------------检查字段的邮件是否规范----------------------
function CheckEmail(strFormName,strFieldName)
{  var objField;
   objField=eval(strFormName+"."+strFieldName);
   objFieldValue=eval(strFormName+"."+strFieldName+".value");
   var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
   if (!filter.test(objFieldValue)) { 
        alert("邮件地址不正确,请重新填写！"); 
        objField.focus();
        return true; 
       } 
   else
   {return false;}
}
//--------------------删除对象行----------------------
   function DeleteByParameter(Parameter)
   {
	 url="?"+Parameter;
	 url+="&Actions=Delete" ;
	 if (confirm("确实要删除吗？"))
       {location.href=url;}
   }
//--------------------保存对象行----------------------   
   function AddSubject(FormName,Action)
   {
       { eval(FormName).action=Action;
	     eval(FormName).Actions.value="Save";
	     disableButton(FormName);
		 eval(FormName).submit();
		 }
   }
//--------------------显示更新对象行----------------------      
   function UpdateSubject(FormName,Parameter)
   { //把参数打散成数组
     //Parameter参数格式：a=1$b=2$c=3
     var arryParameter=Parameter.split("$");
     for (var i=0;i<arryParameter.length;i++)
	    {
		   //找出变量名,值
		   arryParameterLen=arryParameter[i].length;
		   ThePlace=arryParameter[i].indexOf("=");
		   FieldName=arryParameter[i].substr(0,ThePlace)
		   FieldValue=arryParameter[i].substr(ThePlace+1,arryParameterLen-ThePlace)
		   if (eval(FormName+"."+FieldName)!=null)
		      {
			   if (eval(FormName+"."+FieldName).type!="checkbox")
			       {eval(FormName+"."+FieldName).value=ReHtmlFilter(FieldValue);}
			   else
			       {//alert(FieldValue)
	                if (FieldValue=="True")
	                   {eval(FormName+"."+FieldName).checked=true;}
	                else
	                   {eval(FormName+"."+FieldName).checked=false;}				   
				   }
			   }
		}	 
	 eval(FormName).Button.value="更新";
   }
//--------------------初始化控件的值---------------------- 
function ResetState(FormName)
   { eval(FormName).Button.value="添加";   
     eval(FormName).reset();}
//--------------------表单提交---------------------- 	 
function FormSubmit(FormName,Action)
   {
       { //alert(eval(FormName).Actions.value)
	     eval(FormName).action=Action;
	     disableButton(FormName);
	     eval(FormName).submit();
		 }
   }  
//--------------------数据Html语法过滤后反转换----------------------    
function ReHtmlFilter(fString)
{
	 //还原原来的Html标式付
    fString = fString.replace(/&gt;/g, ">")
    fString = fString.replace(/&lt;/g, "<")
    fString = fString.replace(/''/g, "'")
	fString = fString.replace(/&nbsp;/g, String.fromCharCode(32))// 
    fString = fString.replace(/&quot;/g, String.fromCharCode(34))//"
    fString = fString.replace(/&#39;/g, String.fromCharCode(39))//'
    fString = fString.replace(/<BR>/g, String.fromCharCode(10))
	fString = fString.replace(/<P>/g, String.fromCharCode(10))
	return fString
}
//---------------------对齐文本---------------------------------------//
//参数：文本控件对象,模式：0代表普通文本输入框,1代表FCKeditor文本输入框
function ContentAlign(objcontrolName,mode)
{

	var objcontrol;
	//0\检验变量 
	if(mode==null||isNaN(mode)){mode=0;}
	var objcontrolString;
	//1\检查对象是否存在
	if(mode==0)
	{
		objcontrol=document.getElementById(objcontrolName);
	}
	else
	{
		objcontrol=FCKeditorAPI.GetInstance(objcontrolName);	
	}
	
	if(objcontrol!=null)
	{
		//2\如果是普通文本输入框
		if(mode==0) 
		{
			//1>检查字符串是否为空和长度是否为0
			objcontrolString=objcontrol.value;
			if(objcontrolString!=null&&objcontrolString.length>0)
			{
				objcontrol.value=StringTrim(objcontrolString);
				objcontrol.value=StringTrim(objcontrol.value);
			}
		}
		//3\如果是FCKeditor文本输入框
		else
		{
			var objcontrolStringLen;
			var oDOM = objcontrol.EditorDocument ;
			objcontrolString=oDOM.body.innerText;
			if ( document.all )		// If Internet Explorer.
			{
				objcontrolStringLen = objcontrolString.length ;
			}
			else					// If Gecko.
			{
				var r = oDOM.createRange() ;
				r.selectNodeContents( oDOM.body ) ;
				objcontrolStringLen = r.toString().length ;
			}			
			
			if(objcontrolStringLen>0)
			{
				oDOM.body.innerText=StringTrim(oDOM.body.innerText);
				oDOM.body.innerText=StringTrim(oDOM.body.innerText);
			}			
		}
	}

} 

//--------------------过滤字符串开头和尾巴的空格----------------------  
function StringTrim(string)
{
  var FieldValue=string;
  var Blank=String.fromCharCode(32)+String.fromCharCode(32);
  //var Blank="aabb";
  var myArray=new Array;
  var ContentArray=FieldValue.split("\n");
  var TempString="";
  var Block="";
  //循环去掉空字符串
  for(iRow=0;iRow<ContentArray.length;iRow++)
  {Block=ContentArray[iRow].replace(/^\s*|\s*$/g,'');
   //把空的段落内容去掉
   if(Block!="")
     {myArray.push(Blank+Block);}
   }
  //把字符串整理出来
  for(iRow=0;iRow<myArray.length;iRow++)
  {TempString+=myArray[iRow]+"\n\n";} 
  return TempString;
}
//--------------------获取当前时间----------------------  
function GetCurrentTime()
{
   var now = new Date();
   var year =now.getYear();
   var month =now.getMonth();
   month=month+1;
   if (month>=12)
   {month=12;}
   var day=now.getDate();
   var hours = now.getHours();
   var minutes = now.getMinutes();
   var seconds =  now.getSeconds()  
   return year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;
}
//--------------------把所有按钮的状态设为屏蔽状态----------------------  
function disableButton(FormName)
{
   //列举FormName里面的元素，如果是按钮的话
   //并且出现提交状态请等候信息 
   var howMany,iRow,theObject;
   theObject=eval(FormName);
   if (theObject!=null)
   {howMany=theObject.elements.length;
   for(iRow=0;iRow<howMany;iRow++)
   { 
      if(theObject.elements(iRow).type=="button")
	  {theObject.elements(iRow).disabled="true";}
   }
   showSending(FormName);
   }
}
//--------------------显示数据提交题是信息层----------------------  
function showSending(FormName)
{
var theObject=eval(FormName);
var objLayer ='<div id="sending" style="position:absolute; width:200px; height:30px; z-index:2"><img src="/images/system/transfer.gif" width="200" height="30" border="0" style="filter:alpha(opacity=70)"></div>';  
	theObject.insertAdjacentHTML("afterEnd", objLayer);
	sending.style.posLeft =  document.body.scrollLeft+(document.body.offsetWidth-4)/2-100;
	sending.style.posTop = document.body.scrollTop+(document.body.offsetHeight)/2;
}
//-------------------显示操作结果-------------------------
function showResult(msg,align,left,top)
{
	align=align.toLowerCase();
	//1\创建层对象
	var objdiv="";
		objdiv+="<div id=\"showresult\" style=\"display:\'\'; position:absolute; left:183px; top:79px; width:250; height:25; z-index:1;";
		if(align=="rightbottom")
		{
			objdiv+="left:expression(document.body.clientWidth-this.offsetWidth-10);TOP:expression(document.body.clientHeight-this.offsetHeight-10);";
		}
		else if(align=="righttop")
		{
			objdiv+="left:expression(document.body.clientWidth-this.offsetWidth-10);TOP:expression(10);";
		}
		else if(align=="lefttop")
		{
			objdiv+="left:expression(10);TOP:expression(10);";
		}
		else if(align=="leftbottom")
		{
			objdiv+="left:expression(10);TOP:expression(document.body.clientHeight-this.offsetHeight-10);";
		}				
		else if(align=="center")
		{
		    objdiv+="left:expression((document.body.clientWidth-this.offsetWidth)/2);TOP:expression(document.body.clientHeight/2-10);";
		}
		else
		{
			if(left==null||isNaN(left)||left==0)
			{
				objdiv+="left:expression((document.body.clientWidth-this.offsetWidth)/2);";
			}
			else if(left>0)
			{
				objdiv+="left:expression("+left+");";
			}
			if(top==null||isNaN(top))
			{
				objdiv+="TOP:expression((document.body.clientHeight-this.offsetHeight)/2);";
			}
			else
			{
				objdiv+="TOP:expression("+top+");";
			}
		}
		objdiv+="\"> ";
		objdiv+="  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
		objdiv+="    <tr> ";
		objdiv+="      <td width=\"3\" height=\"3\"><img src=\"\/Images\/System\/i.c.l.t.gif\" width=\"3\" height=\"3\"><\/td>";
		objdiv+="      <td bgcolor=\"#FAD163\"><\/td>";
		objdiv+="      <td width=\"3\" height=\"3\"><img src=\"\/Images\/System\/i.c.r.t.gif\" width=\"3\" height=\"3\"><\/td>";
		objdiv+="    <\/tr>";
		objdiv+="    <tr> ";
		objdiv+="      <td bgcolor=\"#FAD163\"><\/td>";
		objdiv+="      <td height=\"20\" bgcolor=\"#FAD163\" align=\"center\"><font size=2>"+msg+"</font><\/td>";
		objdiv+="      <td bgcolor=\"#FAD163\"><\/td>";
		objdiv+="    <\/tr>";
		objdiv+="    <tr> ";
		objdiv+="      <td><img src=\"\/Images\/System\/i.c.l.b.gif\" width=\"3\" height=\"3\"><\/td>";
		objdiv+="      <td bgcolor=\"#FAD163\"><\/td>";
		objdiv+="      <td><img src=\"\/Images\/System\/i.c.r.b.gif\" width=\"3\" height=\"3\"><\/td>";
		objdiv+="    <\/tr>";
		objdiv+="  <\/table>";
		objdiv+="<\/div>";


		//4\把层添加到form的结尾
		document.forms[0].insertAdjacentHTML("afterEnd", objdiv);
		
    	var lay=document.getElementById("showresult");
		if(lay!=null)
		{
			window.setTimeout(function(){lay.style.display="none";},3000);
		}
	}
//添加网页加载事件
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
    window.onload = func;
}else {
    window.onload = function() {
        oldonload();
        func();
    }
}
}	
function bbimg(o){
	var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}
//---------------------把图片预先调出来-------------
MM_preloadImages('/images/transfer.gif','/Images/System/i.c.l.t.gif','/Images/System/i.c.r.t.gif','/Images/System/i.c.l.b.gif','/Images/System/i.c.r.b.gif');
function OpenWindow(URL,Width,Height)
{
   window.open (URL,'newwindow','height='+Height+',width='+Width+',toolbar=no,menubar=no,scrollbars=yes,resizeable=no,location=no,status=no,left='+(window.screen.availWidth-Width)/2+',top='+(window.screen.availHeight-Height)/2+'');
}
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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function readCookie(name){
  var cookieValue = "";
  var search = name + "=";
  //alert(search);
  if(document.cookie.length > 0){ 
    offset = document.cookie.indexOf(search);
    if (offset != -1){ 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

function readURLParameter(FieldName)
{
	var search = FieldName + "=";
	var FieldValue="";
	var URL=location.href;
	var offset = URL.indexOf(search);
	if (offset != -1)
	{ 
	  offset += search.length;
	  end = URL.indexOf("&", offset);
	  if (end == -1)
	  { 
		FieldValue=URL.substring(offset);
	  }
	  else
	  {
		FieldValue=URL.substring(offset,end);
	  }
	}
	return FieldValue;
}

function writeCookie(name, value, hours){
  var expire = "";
  if(hours != null){
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

function ShowLayer(id,CustomerType)
{
	var CustomerType;
	CustomerType=CustomerType;
    MM_showHideLayers('Menu','','show');
	Menu.style.posLeft = window.event.x-100;
	Menu.style.posTop = window.event.y;
}
function ShowLayerMenuSub()
{
    MM_showHideLayers('MenuSub','','show');
}
function ShowLayerMenu()
{
	MenuSub.style.posLeft = window.event.x;
	MenuSub.style.posTop = window.event.y;
    MM_showHideLayers('MenuSub','','show');
}
function ShowLayerMenun(layername)
{  
    MM_showHideLayers(layername,'','show');
}

function doPrint() 
{   
    window.document.body.style.background='#fff';
    bdhtml=window.document.body.innerHTML; 
    sprnstr="<!--startprint-->"; 
    eprnstr="<!--endprint-->"; 
    prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); 
    prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); 
    window.document.body.innerHTML=prnhtml + "<br><p align=center><input type='button' value='返 回' onclick='window.history.go(0)' /></p>"; 
    window.print();       
    //window.history.go(0); 
}

function msnoperate(action, msn) {
	var actionArray = new Array();
	actionArray = {
		'reghotmail' : 'http://go.discuz.com/?app=msn&linkid=1',
		'reglivemail' : 'http://go.discuz.com/?app=msn&linkid=2',
		'regliveid' : 'http://go.discuz.com/?app=msn&linkid=3',
		'download' : 'http://go.discuz.com/?app=msn&linkid=4',
		'add' : 'http://go.discuz.com/?app=msn&linkid=5&msn=' + msn,
		'chat' : 'http://go.discuz.com/?app=msn&linkid=6&msn=' + msn
	}

	if(messengerInstalled()) {
		window.open(actionArray[action]);
	} else {
		window.open('http://go.discuz.com/msn/msn.html','_blank','width=571, height=498');
	}
}

function messengerInstalled() {
      try {
            new ActiveXObject("MSNMessenger.P4QuickLaunch");
            return true;
      }
      catch (e) {
            return false;
      }
}

function FontSize(objID,size)
{
    var obj=document.getElementById(objID);

    obj.style.fontSize = size + "px";
}

var content;
content="";
content="我在[Title]网站发现了一篇好文章，文章标题为: [prodname]， 赶紧去看看，网址是：";
content+=location.href;
function SendToMyFriend(ProdName,SiteName)
{	
    content=content.replace("[prodname]",ProdName);
    content=content.replace("[Title]",SiteName);
    window.clipboardData.setData("Text",  content);
    alert("已经把信息拷贝到粘贴板里面，请把内容通过即时通讯工具发送给你的好朋友广而告之。");
}

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
//显示flash，在IE下不需激活

var loadSwfNav= function( swfBox, swfFile, swfID, swfW, swfH){	
	var o = new SWFObject(swfFile, swfID, swfW, swfH, '8', '#ffffff');
	o.addVariable("allowScriptAccess", 'sameDomain');
	o.addParam("allowScriptAccess", 'sameDomain');
	o.addParam("wmode", 'transparent');
	o.addVariable("wmode", 'transparent');
	o.addParam("menu", "false");
	o.addVariable("menu ", "false");
	o.write( swfBox );
};




function SiteSearchAll(SearchAll,n)
{

	if (n == 0 && SearchAll.value == "请输入关键字")
	{
		SearchAll.value="";
		return false;
	}
	if (n == 1)
	{
		if(SearchAll.value == "请输入关键字")
		{
			SearchAll.value="";
		}
	}
	if (n == 2 && SearchAll.value == "")
	{
		SearchAll.value = "请输入关键字";
	}
	if(n == 4 && (SearchAll.value == "" || SearchAll.value == "请输入关键字"))
	{
		alert("请重新输入关键字...");
		SearchAll.focus();
		return false;
	}
	return true;
}


function SumbitToSearch(){
    if ($ByID('SiteSearch').value==null) 
    { 
        alert("请输入关键字"); 
        return false; 
    }else if($ByID('SiteSearch').value=='请输入关键字'){
        alert("请重新输入关键字..."); 
        return false; 
    }else{ 
        var catTitle=$ByID("__oran__ddlCat").value;
        var orankwd=encodeURI($ByID('SiteSearch').value)
        //var frmAct="../Shop/Default.aspx?SiteSearch="+$ByID('SiteSearch').value;
        var frmAct="../Shop/Default.aspx?";
        switch(catTitle){
            case "sn":frmAct+="oranact=sn&orankwd="+orankwd;break;
            default:frmAct+="oranact=title&orankwd="+orankwd;break;
        }
	    aspnetForm.action=frmAct;
	    aspnetForm.submit();
	}
	return true;
}


function $ByID() 
{ 
  var elements = new Array(); 
  for (var i = 0; i < arguments.length; i++) 
  { 
    var element = arguments[i]; 
    if (typeof element == 'string') 
      element = document.getElementById(element); 
    if (arguments.length == 1) 
      return element; 
    elements.push(element); 
  } 
  return elements; 
}






//限制图片的长宽
function ImageResize(obj,MaxImagWidth,MaxImagHeight)
{	

	var ImagWidth=obj.width;
	var ImagHeight=obj.height;
	var TempImagWidth = ImagWidth;
	var TempImagHeight = ImagHeight;
	//1\检测参数，如果图片不是对象，则退出
	if(obj==null)
	{	
		return;
	}
	//2\如果图片是对象，并且没能检测图片的宽高，  如果图片的最大宽度不为0 ，则返回图片的最大宽度
	else if(obj!=null&&(ImagWidth==0||ImagHeight==0))
	{
		if(MaxImagWidth>0)
		{obj.width=MaxImagWidth;}
		else if(MaxImagHeight>0)
		{obj.height=MaxImagHeight;}
		else
		{return;}
	}
	//3\如果能够检测出图片的实际宽高，则进行宽度调整处理
	else
	{
		try{
	
				//1\如果只限制宽度，则处理宽度就可以了 
				if ((MaxImagWidth!=null&&MaxImagWidth>0)&&MaxImagHeight==0)
				{if(ImagWidth>MaxImagWidth)ImagWidth=MaxImagWidth;} 
				
				
				//2\如果只限制高度，则处理高度就可以了
				else if ((MaxImagHeight!=null&&MaxImagHeight>0)&&MaxImagWidth==0)
				{if(ImagHeight>MaxImagHeight)ImagHeight=MaxImagHeight;}	
				
				
				//3\如果限制高度和宽度，则进行复杂的处理
				else if ((MaxImagHeight!=null&&MaxImagHeight>0)&&(MaxImagWidth!=null&&MaxImagWidth>0))
				{
					//重新计算图片的长度和高度
					//先限制图片的宽度
					//---------------------------------------------------
					//情况1：图片的宽度超过最大限定宽度  
					
					if(ImagWidth > MaxImagWidth)
					{
					
					
						var TempWidth,TempHeight;
						//第一次计算
						TempWidth = MaxImagWidth;
						//计算图片的高度
						TempHeight = parseInt(ImagHeight / ImagWidth * MaxImagWidth);
					
						//第二次计算
						//判断图片的高度是否超出制定的高度
						if(TempHeight > MaxImagHeight)
						{
							TempHeight = MaxImagHeight;
							//重新计算图片的宽度
							TempWidth = parseInt(ImagWidth / ImagHeight * MaxImagHeight);
						}
						ImagWidth = TempWidth;
						ImagHeight = TempHeight;
						
						//alert("a="+ImagHeight / ImagWidth +"b="+parseInt(ImagHeight / ImagWidth * MaxImagWidth))
					}
					//情况2：图片的宽度不超过最大限定宽度，但是高度超过了限定宽度
					else if(ImagHeight > MaxImagHeight)
					{//alert("a="+MaxImagHeight +"b="+parseInt(TempImagWidth / TempImagHeight * MaxImagHeight))
						ImagHeight = MaxImagHeight;
						ImagWidth = parseInt(TempImagWidth / TempImagHeight * MaxImagHeight);
					}
				}
		}
		catch(e)
		{
			//alert(e);
		}
		if(ImagWidth>0&&ImagHeight>0)
		{
			obj.width=ImagWidth;
			obj.height=ImagHeight;
		}
		else
		{
			if(MaxImagWidth!=null&&MaxImagWidth>0)
			{obj.width=MaxImagWidth;}
		}
	}
}


//循环调整对象里面包含图片的长宽
//参数：对象ID,最长宽度,最长高度
function AutoAdjustPictures(objID,MaxWidth,MaxHeight) 
{   
  var   sfEls   =   document.getElementById(objID);   	  
  sfEls   =   sfEls.getElementsByTagName("img");
  for   (var   i=0; i<sfEls.length;i++)  
   {
		  ImageResize(sfEls[i],MaxWidth,MaxHeight);
	}
}

function suitImage(img,w,h)
{
		var image=new Image();
        image.src=document.getElementById(img).src;

		var iw=image.width;
		var ih=image.height;
		var iratio=iw/ih;
        
        if(iw>w)
		{
                iw=w;
				ih=w/iratio;
        }
        if(ih>h)
		{
                ih=h;
                iw=h*iratio;
        }  
		document.getElementById(img).width=iw;
		document.getElementById(img).height=ih;
}


function ImgBtnChgPrd_Mouseover(mainpictureurl)
{
    document.getElementById('mp').src=mainpictureurl;
    
	document.getElementById('mp').width=350;
	document.getElementById('mp').height=350;
		
    
    //suitImage('mp',350,350);
}


function getarea(ip,spanid){
  var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.async="false";
  xmlDoc.load('/getip.asmx/getarea?ip='+ip);  
　document.getElementById(spanid).innerHTML=xmlDoc.documentElement.childNodes[0].text
} 





function ChooseColor(LabelID,curID)
{
    var getcolor=$ByID("color");
    if(LabelID.length>0){
        for( var i=0;LabelID[i];i++)
        {
          if(i!=curID)
          {
	        LabelID[i].className='';
	        }
          else
          {
	        LabelID[i].className='cleck';
	        $ByID('YourChoose').innerHTML='您已选择：<font color=red>"'+LabelID[i].innerHTML+'"</font>';
	        getcolor.value=LabelID[i].innerHTML;
          }	  
        }
     }else{
        LabelID.className='cleck';
        $ByID('YourChoose').innerHTML='您已选择：<font color=red>"'+LabelID.innerHTML+'"</font>';
        getcolor.value=LabelID.innerHTML;
     }
}


function testChooseColor()
{
   var getcolor=$ByID("color");
   if(!getcolor.value){alert("请选择： \"颜色\"") ; return false;}
}




function PhoneMobileValidate(source, arguments)
{
	//如果手机号码输入框为空，则判断固定电话，否则直接返回true
	if(arguments.Value == "")
	{
		if($ByID("ctl00_Content_Trade1_TradeCart1_txtTel").value == "")
		{
			arguments.IsValid = false;
		}
		else
		{
			arguments.IsValid = true;
		}
	}
	else
	{
		arguments.IsValid = true;
	}
}
