if(window.ActiveXObject)window.ie = window[window.XMLHttpRequest?'ie7':'ie6'] = true;
var theClear="../include/clear.gif" //path to clear.gif
fPngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=theClear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight-el.currentStyle.paddingTop.replace("px","")-el.currentStyle.paddingBottom.replace("px","")+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}
if(window.ie6){window.attachEvent('onload',fPngfix);};
function __firefox(){HTMLElement.prototype.__defineGetter__("runtimeStyle", __element_style);window.constructor.prototype.__defineGetter__("event", __window_event);Event.prototype.__defineGetter__("srcElement", __event_srcElement);}
function __element_style(){return this.style;}
function __window_event(){return __window_event_constructor();}
function __event_srcElement(){return this.target;}
function __window_event_constructor(){if(document.all){return window.event;}var _caller = __window_event_constructor.caller;while(_caller!=null){var _argument = _caller.arguments[0];if(_argument){var _temp = _argument.constructor;if(_temp.toString().indexOf("Event")!=-1){return _argument;}}_caller = _caller.caller;}return null;}
if(window.addEventListener){__firefox();}
function ff_offsetX(){var _o=event.target;var _x=0;while(_o.offsetParent){_x+=_o.offsetLeft;_o=_o.offsetParent;}return event.pageX-_x;}
function ff_offsetY(){var _o=event.target;var _y=0;while(_o.offsetParent){_y+=_o.offsetTop;_o=_o.offsetParent;}return event.pageY-_y;}
fFormSytle= function(){
var theInput = document.getElementsByTagName("input");
for(var i=0; i<theInput.length; i++){if(theInput[i].type == "text" || theInput[i].type == "password" || theInput[i].type == "file"){theInput[i].className = "inputBlur";theInput[i].onfocus = function(){this.className = "inputFocus";};theInput[i].onblur = function(){this.className = "inputBlur";}}}
var theTextarea = document.getElementsByTagName("textarea");
for(var i=0; i<theTextarea.length; i++){theTextarea[i].className = "textareaBlur";theTextarea[i].onfocus = function(){this.className = "textareaFocus";};theTextarea[i].onblur = function(){this.className = "textareaBlur";}}
var theButton = document.getElementsByTagName("button");
for(var i=0; i<theButton.length; i++){theButton[i].className = "buttonOut";theButton[i].onmouseover = function(){this.className = "buttonOver";};theButton[i].onmouseout = function(){this.className = "buttonOut";}}}
if(window.ie){window.attachEvent('onload',fFormSytle);}else{window.addEventListener('load',fFormSytle,true);};
document.write('<div id="jsBlock" style="display:none; width:0px; height:0px;">&nbsp;</div>');
function fJsFile(nUpType,nInputName,nSavePath,nFileType,nMaxSize,nFileName){
	if(!nInputName){nInputName="";};if(!nSavePath){nSavePath="";};if(!nFileType){nFileType="";};if(!nMaxSize){nMaxSize="";};if(!nFileName){nFileName="";};
	if(nUpType=="User"){theUpLoad = "include/";}else if(nUpType!=""){theUpLoad = "../include/";}
	//输出控制界面
	nDateHtml = '<div id="jsFile" style="position:absolute;">';
	nDateHtml += '<iframe src="about:blank" name="jsFileIframe" frameborder="0" width="0" height="0" style="display:none;"></iframe>';
	nDateHtml += '<form action="'+theUpLoad+'fileUp.asp?nUpType='+nUpType+'&nInputName='+nInputName+'&nSavePath='+nSavePath+'&nFileType='+nFileType+'&nFileName='+nFileName+'&nMaxSize='+nMaxSize+'" target="jsFileIframe" enctype="multipart/form-data" method="post">';
	nDateHtml += '<table id="jsFileTable" border="0" cellpadding="0" cellspacing="0">';
	nDateHtml += '<tr><th>上传文件：</th><td><input name="upFileRoom" id="upFileRoom" type="file" /></td></tr>';
	nDateHtml += '<tr><th>常规操作：</th><td><button type="submit">提交上传</button><button type="button" onclick="fJsFileIn();">取消上传</button></td></tr>';
	nDateHtml += '<tr><th>上传限制：</th><td>文件格式：'+nFileType+'；文件大小：'+nMaxSize+'KB；固定名称：'+nFileName+'</td></tr>';
	nDateHtml += '</table>';
	nDateHtml += '</form>';
	nDateHtml += '</div>';
	document.getElementById("jsBlock").innerHTML = nDateHtml;
	document.getElementById("jsBlock").style.display = "";
	nJsObj = document.getElementById("jsFile");
	//控制层位置
	nInputObj = document.getElementById(nInputName);
	if(window.ie){
		nJsObj.style.left = event.clientX - event.offsetX + document.documentElement.scrollLeft - nInputObj.offsetWidth + "px";
		nJsObj.style.top = (event.clientY - event.offsetY) + (document.documentElement.scrollTop + document.body.scrollTop) + nInputObj.scrollHeight + (nInputObj.clientHeight - nInputObj.scrollHeight) + (nInputObj.offsetTop - nInputObj.offsetLeft) + "px";
	}else{
		nJsObj.style.left = event.clientX - ff_offsetX() + document.documentElement.scrollLeft - nInputObj.offsetWidth + "px";
		nJsObj.style.top = (event.clientY - ff_offsetY()) + (document.documentElement.scrollTop + document.body.scrollTop) + nInputObj.scrollHeight - 1 + "px";
	}
	fFormSytle();//重新调用表单事件效果
}
function fJsFileIn(nUpType,nInputName,nFileName,nMaxSize){
	document.getElementById("jsBlock").style.display = "none";
	//document.getElementById("jsBlock").innerHTML = "";//开启此项会因为关闭太快，导致fileup页面无法关闭而一直在读取。
	if(document.getElementById(nInputName)){
		document.getElementById(nInputName).value = nFileName;
	}
}
function fJsHidden(nFiled,nId,nTab,nClass){
	for (i=1;i<=99;i++){
		if (document.getElementById(nFiled+i) && i!=nId){
			document.getElementById(nFiled+i).style.display="none";
			if (nTab){document.getElementById(nTab+i).className="";}
		}
	}
	if(document.getElementById(nFiled+nId)){
		if (document.getElementById(nFiled+nId).style.display=="none"){
			document.getElementById(nFiled+nId).style.display="";
			if (nTab){document.getElementById(nTab+nId).className=nClass;}
		}else{
			document.getElementById(nFiled+nId).style.display="none";
			if (nTab){document.getElementById(nTab+nId).className="";}
		}
	}
}
function fJsFlash( arg ){
	var parm = []
	var _default_version = "8,0,24,0";
	var _default_quality = "high";
	var _default_align = "middle";
	var _default_menu = "false";
	
	for(i = 0; i < arguments.length; i ++){
		parm[i] = arguments[i].split(' ').join('').split('=')
		for (var j = parm[i].length-1; j > 1; j --){
			parm[i][j-1]+="="+parm[i].pop();
		}
		switch (parm[i][0]){
			case '_version' : var _version = parm[i][1] ; break ; 
			case '_swf' : var _swf = parm[i][1] ; break ; 
			case '_base' : var _base = parm[i][1] ; break ; 
			case '_quality' : var _quality = parm[i][1] ; break ; 
			case '_loop' : var _loop = parm[i][1] ; break ; 
			case '_bgcolor' : var _bgcolor = parm[i][1] ; break ; 
			case '_wmode' : var _wmode = parm[i][1] ; break ; 
			case '_play' : var _play = parm[i][1] ; break ; 
			case '_menu' : var _menu = parm[i][1] ; break ; 
			case '_scale' : var _scale = parm[i][1] ; break ; 
			case '_salign' : var _salign = parm[i][1] ; break ; 
			case '_height' : var _height = parm[i][1] ; break ; 
			case '_width' : var _width = parm[i][1] ; break ; 
			case '_hspace' : var _hspace = parm[i][1] ; break ; 
			case '_vspace' : var _vspace = parm[i][1] ; break ; 
			case '_align' : var _align = parm[i][1] ; break ; 
			case '_class' : var _class = parm[i][1] ; break ; 
			case '_id' : var _id = parm[i][1] ; break ; 
			case '_name' : var _name = parm[i][1] ; break ; 
			case '_style' : var _style = parm[i][1] ; break ; 
			case '_declare' : var _declare = parm[i][1] ; break ; 
			case '_flashvars' : var _flashvars = parm[i][1] ; break ; 
			default :;
		}
	}
	var thtml = ""
	thtml += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + ((_version)?_version:_default_version) + "'"
	if(_width) thtml += " width='" + _width + "'"
	if(_height) thtml += " height='" + _height + "'"
	if(_hspace) thtml += " hspace='" + _hspace + "'"
	if(_vspace) thtml += " vspace='" + _vspace + "'"
	if(_align) thtml += " align='" + _align + "'"
	else thtml += " align='" + _default_align + "'"
	if(_class) thtml += " class='" + _class + "'"
	if(_id) thtml += " id='" + _id + "'"
	if(_name) thtml += " name='" + _name + "'"
	if(_style) thtml += " style='" + _style + "'"
	if(_declare) thtml += " " + _declare
	thtml += ">"
	if(_swf) thtml += "<param name='movie' value='" + _swf + "'>"
	if(_quality) thtml += "<param name='quality' value='" + _quality + "'>" 
	else thtml += "<param name='quality' value ='" + _default_quality + "'>"
	if(_loop) thtml += "<param name='loop' value='" + _loop + "'>"
	if(_bgcolor) thtml += "<param name='bgcolor' value='" + _bgcolor + "'>"
	if(_play) thtml += "<param name='play' value='" + _play + "'>"
	if(_menu) thtml += "<param name='menu' value='" + _menu + "'>"
	else thtml += "<param name='menu' value='" + _default_menu + "'>"
	if(_scale) thtml += "<param name='scale' value='" + _scale + "'>"
	if(_salign) thtml += "<param name='salign' value='" + _salign + "'>"
	if(_wmode) thtml += "<param name='wmode' value='" + _wmode + "'>"
	if(_base) thtml += "<param name='base' value='" + _base + "'>"
	if(_flashvars) thtml += "<param name='flashvars' value='" + _flashvars + "'>"
	thtml += "<embed pluginspage='http://www.macromedia.com/go/getflashplayer'"
	if(_width) thtml += " width='" + _width + "'"
	if(_height) thtml += " height='" + _height + "'"
	if(_hspace) thtml += " hspace='" + _hspace + "'"
	if(_vspace) thtml += " vspace='" + _vspace + "'"
	if(_align) thtml += " align='" + _align + "'"
	else thtml += " align='" + _default_align + "'"
	if(_class) thtml += " class='" + _class + "'"
	if(_id) thtml += " id='" + _id + "'"
	if(_name) thtml += " name='" + _name + "'"
	if(_style) thtml += " style='" + _style + "'"
	thtml += " type='application/x-shockwave-flash'"
	if(_declare) thtml += " " + _declare 
	if(_swf) thtml += " src='" + _swf + "'"
	if(_quality) thtml += " quality='" + _quality + "'"
	else thtml += " quality='" + _default_quality + "'"
	if(_loop) thtml += " loop='" + _loop + "'"
	if(_bgcolor) thtml += " bgcolor='" + _bgcolor + "'"
	if(_play) thtml += " play='" + _play + "'"
	if(_menu) thtml += " menu='" + _menu + "'"
	else thtml += " menu='" + _default_menu + "'"
	if(_scale) thtml += " scale='" + _scale + "'"
	if(_salign) thtml += " salign='" + _salign + "'"
	if(_wmode) thtml += " wmode='" + _wmode + "'"
	if(_base) thtml += " base='" + _base + "'"
	if(_flashvars) thtml += " flashvars='" + _flashvars + "'"
	thtml += "></embed>"
	thtml += "</object>"
	document.write(thtml)
}