
function SetScroll(){
	if(window.screen.width <= 850 || window.screen.height <= 700){
		window.scrollBy(0,44);
	}
}

function SetDefaultScroll(){
	var obj = document.getElementById("footer");
	if(obj){
		SetScroll();
	}else{
		setTimeout("SetDefaultScroll()",500);
	}
}

function setEmbed() 
{ 
  var obj = new String; 
  var parameter = new String; 
  var embed = new String; 
  var html = new String; 
  var allParameter = new String; 
  var clsid = new String; 
  var codebase = new String; 
  var pluginspace = new String; 
  var embedType = new String; 
  var src = new String; 
  var width = new String; 
  var height = new String; 

    
  this.init = function( getType , s ,w , h ) { 
      
      if ( getType == "flash") 
      { 

        clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";        
        codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"; 
        pluginspage = "http://www.macromedia.com/go/getflashplayer"; 
        embedType = "application/x-shockwave-flash"; 
      } 
      else if ( getType == "media") 
      { 
					clsid="22D6F312-B0F6-11D0-94AB-0080C74C7E95";
					codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";
					embedtype="application/x-oleobject";
      } 

            
      parameter += "<param name='movie' value='"+ s + "'>\n";  
      parameter += "<param name='quality' value='high'>\n";    
      
      src = s; 
      width = w; 
      height = h; 
  } 
  
  this.parameter = function( parm , value ) {      
      parameter += "<param name='"+parm +"' value='"+ value + "'>\n";        
      allParameter += " "+parm + "='"+ value+"'"; 
  }  
  
  this.show = function() { 
      if ( clsid ) 
      { 
        obj = "<object classid=\"clsid:"+ clsid +"\" codebase=\""+ codebase +"\" width='"+ width +"' height='"+ height +"'>\n"; 
      } 
      
      embed = "<embed src='" + src + "' pluginspage='"+ pluginspage + "' type='"+ embedType + "' width='"+ width + "' height='"+ height +"'"+ allParameter +" ></embed>\n"; 
      
      if ( obj ) 
      { 
        embed += "</object>\n"; 
      } 
      
      html = obj + parameter + embed; 
      
      document.write( html );  
  } 
  
} 

function CheckState(statInt,autoID){
	OpenWin("/Backadmin/Cms/CmsState.asp?S="+ statInt +"&id=" + autoID,300,200)
}

function OpenWin(linkPath,width,height,scroll,resiz){

	var left = (window.screen.width  - width)  / 2 - 30;
	var top  = (window.screen.height - height) / 2 - 30;
	
	var scrollbars = "no";
	var resizable  = "no";
	
	if(scroll) scrollbars = scroll;
	if(resiz)  resizable  = resiz;
	
	window.open(linkPath,"","width="+ width +",height="+ height +",left="+ left +",top="+ top +",scrollbars="+ scrollbars +",resizable=" + resizable);
}

var subImg = null;

function ChangeMainMenuImg(obj,is){

	//ÖØÖÃËùÓÐ
	var ids = new Array("Default","11001","11002","11003","11004","11005","11006","11007","11008","11009","11010");
	
	for(var i=0;i<ids.length;i++){
		var imgObj = document.getElementById(ids[i]);
		var rmgObj = document.getElementById(ids[i] + "_R");
		if(imgObj){
			if(imgObj.src.indexOf("__") > -1) imgObj.src = imgObj.src.replace("__","_");
			if(ids[i].toUpperCase() != 'DEFAULT' && ids[i].toUpperCase() != '11010' && rmgObj.src.indexOf("__") > -1) rmgObj.src = rmgObj.src.replace("__","_");
		}
	}

	var img = obj.src;
	var rmg = document.getElementById(obj.id + "_R");
	if(is){
		if(img.indexOf("__") == -1) obj.src = img.replace("_","__");
		if(obj.id.toUpperCase() != 'DEFAULT' && obj.id.toUpperCase() != '11010' && rmg.src.indexOf("__") == -1) rmg.src = rmg.src.replace("_","__");
		subImg = obj;
	}else{
		if(img.indexOf("__") > -1) obj.src = img.replace("__","_");
		if(obj.id.toUpperCase() != 'DEFAULT' && obj.id.toUpperCase() != '11010' && rmg.src.indexOf("__") > -1) rmg.src = rmg.src.replace("__","_");
	}

	if(obj.id.toUpperCase() != 'DEFAULT' && obj.id.toUpperCase() != '11010'){
		var subObj = document.getElementById("SubMenuDiv");
		if(subObj){
			SetMainMenuDisplay(subObj,is)
			SubMenu.innerHTML = document.getElementById(obj.id + "_SD").innerHTML;
		}
	}
}

function SetMainMenuDisplay(obj,is){
	if(is){
		obj.style.display = "block";
		try{obj.filters.alpha.opacity = 50;}catch(e){}
	}else{
		obj.style.display = "none";
		try{obj.filters.alpha.opacity = 50;}catch(e){}
	}
}

function ChangeSubLay(is){

	var subObj = document.getElementById("SubMenuDiv");
	
	if(is){
		subObj.style.display = "block";
	}else{
		subObj.style.display = "none";
	}

	if(subObj && subImg && subImg != null){
		var rmg = document.getElementById(subImg.id + "_R");
		var img = subImg.src;
		if(is){
			subImg.src = img.replace("_","__");
			rmg.src = rmg.src.replace("_","__");
		}else{
			subImg.src = img.replace("__","_");
			rmg.src = rmg.src.replace("__","_");
		}
	}
}

var inNum = 0;

function InitSubMunuDiv(){

	var obj = document.getElementById("SubMenuDiv");
	if(obj){
		var spaceWidth = window.screen.width - parseInt(obj.style.width.toLowerCase().replace("px",""));
		obj.style.left = spaceWidth / 2;
		try{obj.filters.alpha.opacity = 50;}catch(e){}
	}else if(inNum <= 10){
		inNum ++;
		setTimeout("InitSubMenuDiv",1000);
	}
}

function ChangeTopDiv(obj,index){

	if(obj){
		obj.src = "Images/Main/topic"+ index +".gif"
	}
	
	for(var i=1;i<=4;i++){
		var divObj = document.getElementById("top_" + i);
		if(divObj){
			divObj.style.display = "none";
		}
	}
	
	var divObj = document.getElementById("top_" + index);
	if(divObj) divObj.style.display = "block";
	
	var moreObj = document.getElementById("topMore");
	if(index == 1 || index == 2){
		moreObj.href = "SubDefault.asp?M=11020";
	}else if(index == 3){
		moreObj.href = "List.asp?M=11001008002";
	}else if(index == 4){
		moreObj.href = "List.asp?M=11010";
	}
	
	return false;
}