if( ! window.console){//if no firebug 
	window.console={};
	console.debug= console.info= console.warn= console.error=function(){};
}
try{
	document.execCommand("BackgroundImageCache", false, true) ;        
}catch(ignore){};
function addfavorite(_,$){try{window.external.addFavorite(_,$)}catch(A){try{window.sidebar.addPanel($,_,"")}catch(A){}}} 
/*延时执行*/
function DTry( f ,arg, owner){
	setTimeout(function(){ 
		f.apply( owner||window, arg ||[] ); /*f= null;owner=null;arg=null*/; 
	} ,10);
}
getXMLHttpRequest=function(){
	var xh;
	if(window.XMLHttpRequest)
	{
		xh=new XMLHttpRequest();
	}
	else if(window.ActiveXObject){	
			var p=["MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
			for(var i=0;i<p.length;i++){
				try{
					xh=new ActiveXObject(p[i]);
				}catch(e){
					m=e.description;
				};
			}
	}
	if(!xh){
		throw new Error("can't create XMLHttpRequest");
	}
	return xh;
}
String.prototype.setUrlArg=function( name , value ){
	var url = this.replace(/#.*$/g,"")
		.replace(/\s+$/,"");
	if( url.indexOf("?") == -1 )
	{
		return url + "?" + name + "=" +  encodeURIComponent( value ) ;
	}
	
	url = url.replace(new RegExp( "&*"+name+"=[^&]*" ) , "");
	if( url.indexOf("?") == url.length)
	{
		return url +  name + "=" +  encodeURIComponent( value ) ;
	}
	else{
		
		return url + "&"+ name + "=" +  encodeURIComponent( value ) ;
	}
}
function addCsss( path ){
	var link = document.createElement("link");
	link.setAttribute("rel","stylesheet");
	link.setAttribute("type","text/css");
	link.setAttribute("href", path );
	document.getElementsByTagName("head")[0].appendChild( link );
}

var AJUpdate=function (href,targetID,callBack){
	try{
		AJUpdate._xh.abort();
	}catch(ignore){};

	var xh = getXMLHttpRequest();
	AJUpdate._xh= xh;
	if(xh==null )
	{
		return false;
	}
	document.getElementById(targetID).innerHTML="<div class='loading'><span>载入中...</span></div>";
	xh.open("GET",href,true);
	xh.onreadystatechange=function(){
		//alert(xh.readyState);
		if(xh.readyState=="4")
		{
			
			document.getElementById(targetID).innerHTML = xh.responseText;
			
			var scripts = document.getElementById(targetID).getElementsByTagName("script");
			for(var i=0;i<scripts.length;i++)
			{
					AJUpdate._eval( scripts[i].innerHTML );
					
			};
			if(callBack)
				callBack(href,targetID,xh);
			targetID=null;
			xh=null;
			callBack=null;
			AJUpdate._xh = null;
		}
	}
	xh.send(null);
}
AJUpdate._eval=function(s){return eval(s);}


function jumpKeypress(obj,evt){
	if( evt.keyCode==13 )
	{
		jumppage( obj , evt );
	}
}



function fiximagesize( oImage , widthauto ){
	var pNode = oImage.parentNode;
	if( !pNode)
		return;
	var width = oImage.width;
	var height = oImage.height;
	var pw = parseInt( pNode.offsetWidth);
	var ph = parseInt( pNode.offsetHeight);
	if(!(navigator.appVersion.indexOf("MSIE 6")>0))
	{
		oImage.style.maxHeight = ph +"px";
		if(!widthauto)
			oImage.style.maxWidth = pw +"px";
		
	}
	else{
	
		if( !widthauto && width > pw )
		{
			oImage.width = pw;
			oImage.height = parseInt(height * pw/width);
			
		}
		
		//alert([oImage.height ,ph / oImage.height,oImage.width * ph / oImage.height])
		
		if(oImage.height>ph)
		{
			oImage.width = parseInt( oImage.width * ph / oImage.height);
			oImage.height = ph;
			//alert([oImage.width]);
		}
	}
	
	oImage.style.display="block";
	oImage.style.marginTop = ( ph - oImage.offsetHeight  )/2 +"px";
	oImage.style.marginLeft = ( pw - oImage.offsetWidth  )/2 +"px";
	//alert([width,height,pw,ph]);

	oImage =  null;
		
	
	
}

/*******************************
	标签页初始化
*******************************/
function initTab( id ){
	var obj = document.getElementById( id );
	var className = " "+obj.className+" ";
	var tmpPage = new Array();
	var preSel = false;
	var pagedivs = obj.childNodes;
	
	
	if( !( /(\s)tab(\s)/i.test( className ) ) )
	{
		obj.className+=" tab";
	} 
	
	for( var i=0;i<pagedivs.length;i++)
	{
		if( String.prototype.toLocaleLowerCase.call( pagedivs[i].tagName ) != "div"  )
			continue;
		className = " "+pagedivs[i].className+" ";
		if( !( /(\s)page(\s)/i.test( className ) ) )
		{
			pagedivs[i].className+=" page";
		} 
		var h3 = pagedivs[i].getElementsByTagName("h3")[0];
		if( h3 == null )
			continue;
			
		h3.onmouseover = 
		h3.onclick = initTab.hover_h3(id);
		h3.style.cursor="pointer";
		tmpPage.push( pagedivs[i] );
		pagedivs[i]._h3Index = i;
		
		if( !preSel && /(\s)selected(\s)/.test( className ) )
		{
			preSel = true;
			initTab.tmpH3[id] = h3;
		}
		
	}
	
	
	//没有初始选中，则选中第一个
	if( !preSel && tmpPage[0])
	{
		tmpPage[0].className += " selected";
		initTab.tmpH3[id] = tmpPage[0].getElementsByTagName("h3")[0];
	}
}
initTab.tmpH3={};
initTab.hover_h3=function(id){
	return function(){
		var h3 = this;
		var root = h3.parentNode.parentNode;
		var childNodes = root.childNodes;
		for(var i=childNodes.length-1;i>-1;i--)
		{
			var className = " " + childNodes[i].className   +" ";
			if( /(\s+)page(\s+)/i.test( className ) ==true )
			{
				//清楚以前的选择
				childNodes[i].className = childNodes[i].className.replace(/selected/ig,"")
			}
		}
		var pageDiv = h3.parentNode;
		pageDiv.className += " selected";
	
		initTab.timer = setTimeout( initTab.delay( h3 ,id) , 0);
		h3.onmouseout = initTab.mouseout_h3(id);
	}
}
initTab.mouseout_h3=function(id){
	return function(){
		clearTimeout( initTab.timer );
		if( initTab.tmpH3[id] )
		{
			//使用以前的
			initTab.hover_h3.call( initTab.tmpH3[id] ,id  );
		}
		this.onmouseout = new Function();
	}
}
initTab.delay=function( obj,id ){
	return function(){
		initTab.tmpH3[id] = obj;
	};
};

function stopEvt( evt ){
	if( evt.stopPragation)
	{
		evt.stopPragation();
		evt.preventDefalt();
			
	}
	else{
		
		evt.returnValue = false;
		evt.cancelBubble = true;
	}
	
}
function getChildNodesByTagName(pNode,tagName){
	var nodes = pNode.childNodes;
	var ret = [];
	for(var i=0 ; i<nodes.length;i++)
	{
		var _tag = String.prototype.toLocaleLowerCase.call( nodes[i].tagName );
		if( _tag == tagName )
		{

			ret.push( nodes[i] );
		}
	}
	return ret;
}
function $(sid){return document.getElementById(sid);}

window.ifrmload=function( objbh ){
	ifrmload.all.push(objbh);
}
ifrmload.load = function(){
	if( ifrmload.all.length==0)
		return;
	document.write("<iframe id='objdeferiframe' src='"+contextpath+"/inc/iframeload.jsp?objbh="+ 
			ifrmload.all.join(",")
		 +"'></iframe>");
}
ifrmload.all=new Array();

function OBJ_SCRIPT(sFun , sid){
	var f;
	eval( "f="+sFun );
	DTry( f , sid )
}


try{
	document.execCommand("BackgroundImageCache", false, true) ;        
}catch(ignore){};

var createFlsh=function(id,filePath){

	document.getElementById( id ) .innerHTML 
		=
	"<object  "+
	" width='100%' "+
	" data='" + filePath + "' " +
	" height='100%' type='application/x-shockwave-flash' AUTOSTART=1 loop='1' wmode='transparent' ShowControls ='0'  > "+
	"<param name='movie' value='" + filePath + "' /> "+
	"<param name='quality' value='high' /> "+
	"<param name='AUTOSTART' value='1' /> "+
	"<param name='loop' value='1' /> "+
	"<param name='ShowControls' value='0' /> "+
	"<param name='wmode' value='transparent' /> "+
	"</object>";
}
