
//<!--* ****************************************************** -->
//<!--*					公用客户端JS脚本					 -->
//<!--* ****************************************************** -->
	
// 打开新窗口
function OpenNewWindow(url){
	window.open(url);
}

// 打开模式对话框
function OpenDialogWindow(url,title,width,height){
	var s;
	if(width == null)
		width = 600;
	if( height == null )
		height = 400;
	if( width >= 600 )
		s = "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;resizable:no;status:no;scroll:yes";
	else
		s = "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;resizable:no;status:no;scroll:no";
    var result = window.showModalDialog(url,title,s );
    if( "reload" == result )
		window.location.href=window.location.href;
	else if( "Refresh" == result )
		document.forms[0].submit();
	else
		return false;

}
// 按"ESC"键关闭窗口
function EscToCloseWindow(){
	if(event.keyCode == 27)
		closeWindow();
}
// 关闭窗口
function closeWindow(){
	window.opener = null;
	window.close();
}
// 将回车转换为 Tab
function EnterToTab()
{
	if(event.keyCode == 13 && (event.srcElement.type == "text" || event.srcElement.type == "password"))
		event.keyCode = 9;
}

// 检测上传图片文件格式是否有效
function CheckImageFileIsValidate( photoFile, isUpload ){
	var fileUpload = eval("document.all." + isUpload );
	var postFile = eval( "document.all." + photoFile );
	fileUpload.value = "true";	// 默认上传图片文件
	strFileName = postFile.value;
	var re = /^\s+|\s+$/g;
	strFileName = strFileName.replace( re,"" );
	if( strFileName == "" || strFileName.length < 5 ){
		fileUpload.value = "false";
		return true;
	}

	var postfix = strFileName.substring( strFileName.lastIndexOf("."), strFileName.length ).toUpperCase();
	if( postfix == ".MPEG" || postfix == ".MPG" || postfix == ".AVI" || postfix == ".WMV" || postfix == ".WMA" )
	{
		return true;
	}
	else if( postfix != ".BMP" && postfix != ".JPG" && postfix != ".GIF" && postfix != ".PNG" )
	{
		if(confirm("上传的图片格式无效！是否继续？"))
		{
			fileUpload.value = "false";
			return true;
		}
		else
		{
			return false;
		}
	}
	return true;
}
// 图片缩放
var count = 10;
function Picture( imgObject )
{
	count = Counting(count);
	imgObject.style.zoom = count + '0%';
	return false;
}
function Counting(count){   
    if (event.wheelDelta >= 120)
        count++;
    else if (event.wheelDelta <= -120)
        count--;   
    return count; 
}

// 页面结束块
function EndBlock(urlHome,colorValue)
{
	var str;
	str="<a style='color:" + colorValue + "' href='" + urlHome + "Inc/HomePage/webhelp/zc.shtml'>本站帮助</a> <font color='" + colorValue + "'>|</font> "
		+"<a style='color:" + colorValue + "' href='" + urlHome + "Inc/HomePage/about/gywm.html'>关于本站</a> <font color='" + colorValue + "'>|</font> "
		+"<a style='color:" + colorValue + "' href='" + urlHome + "Inc/HomePage/about/ggkl.html'>广告服务</a> <font color='" + colorValue + "'>|</font> "
		+"<a style='color:" + colorValue + "' href='" + urlHome + "Inc/HomePage/about/mjxs.html'>诚聘英才</a> <font color='" + colorValue + "'>|</font> "
		+"<a style='color:" + colorValue + "' href=mailto:info@golfonlife.com>联系我们</a>"
		+"<br><font color=" + colorValue + "' >Copyright &copy; 2004 - 2006 GolfOnLife Inc. All Rights Reserved</font><br><br>"
		+"<a style='color:" + colorValue + "' href='" + urlHome + "' target=_blank>上海高林文化传播有限公司</a> <font color='" + colorValue + "'>[</font>"
		+"<a  class='bule' href='http://www.miibeian.gov.cn' target =_blank>沪ICP备05049352号</a><font color='" + colorValue + "'>]</font>";
	document.write(str);
}
//全选
//chkAll--传全选CheckBox对象
//itemID--传DataGrid(块)的ClientID
//块中间的CheckBoxID必须包含chkItem_
function CheckAll(chkAll, itemID)
{
	var objs =document.all.tags("input");
	for(var i=0;i<objs.length;i++)
	{
		if(objs[i].type.toUpperCase() =="CHECKBOX" && objs[i].name.indexOf("EvertchkItem")>-1 && objs[i].disabled == "")
			objs[i].checked = chkAll.checked;	
	}
}
//等比例缩放图片
//obj图像对象
//MaxW，MaxH
function ResizeImage(obj, MaxW, MaxH)
{
	if (obj != null) imageObject = obj;
	var state=imageObject.readyState;
	if(state!='complete') 
	{
		setTimeout("ResizeImage(null,"+MaxW+","+MaxH+")",50);
		return;
	}
	var oldImage = new Image();
	oldImage.src = imageObject.src;
	var dW=oldImage.width; var dH=oldImage.height;
	if(dW>MaxW || dH>MaxH)
	{
       a=dW/MaxW; b=dH/MaxH;
      if(b>a) a=b;
      dW=dW/a; dH=dH/a;
	 }
	 
	if(dW > 0 && dH > 0)
	{
		imageObject.width=dW;
		imageObject.height=dH;
	}
}

function e3i5size() 
{

	var e3i5;//=new Array()
	for (i=0; i<fqy.length; i++)
	{	
		if (document.getElementById)
		{
	//自动调整iframe高度
			e3i5 = document.getElementById(fqy[i]);			
			if (e3i5 && !window.opera)
			{			
			e3i5.style.display="block"
			if (e3i5.contentDocument && e3i5.contentDocument.body.offsetHeight) //如果用户的浏览器是NetScape
			e3i5.height = e3i5.contentDocument.body.offsetHeight; 
			else if (e3i5.Document && e3i5.Document.body.scrollHeight) //如果用户的浏览器是IE
			e3i5.height = e3i5.Document.body.scrollHeight;
			}
		}
	//根据设定的参数来处理不支持iframe的浏览器的显示问题
		if ((document.all || document.getElementById) && iframehide=="no")
		{
		var tempobj=document.all?document.all[fqy[i]]:document.getElementById(fqy[i])
		tempobj.style.display="block"
		}
	}
}
