﻿function getObject(objectId) 
{
	if(document.getElementById && document.getElementById(objectId)) 
	{
	// W3C DOM
		return document.getElementById(objectId);
	} 
	else if (document.all && document.all(objectId)) 
	{
	// MSIE 4 DOM
		return document.all(objectId);
	} 
	else if (document.layers && document.layers[objectId]) 
	{
	// NN 4 DOM.. note: this won"t find nested layers
		return document.layers[objectId];
	} 
	else 
	{
		return false;
	}
}

/*===============================================================================================================
函数名:setFlash
作 用:去掉flash激活提示
参 数:FlashURL Flash路径,FlashWidth Flash宽度,FlashHeight Flash高度
================================================================================================================*/
function setFlash(FlashURL,FlashWidth,FlashHeight)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+FlashWidth+'" height="'+FlashHeight+'">');
	document.write('<param name="movie" value="'+FlashURL+'" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="wmode" value="opaque" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="quality" value="high" />');
	document.write('<embed src="'+FlashURL+'" quality="high" wmode="opaque" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+FlashWidth+'" height="'+FlashHeight+'"></embed>\n');
	document.write('</object>');
}

//改变图片大小
function resizepic(o)
{ 
	var maxwidth=550;   //定义最大宽度
	var maxheight=800;  //定义最大高度
	var a=new Image();
	a.src=o.src
	if(a.width > maxwidth)
	{
		o.style.width=maxwidth;
	}
	if (a.height> maxheight)
	{
		o.style.height=maxheight;
	}
}
function ChangDiv()
{
	getObject("HideLayer").style.display = "";
	setTimeout("HideDiv()",8000)   //全屏的持续时间
}
function HideDiv()
{
	getObject("HideLayer").style.display = "none";
}
function ShowFull()
{
	setTimeout("ChangDiv()",2000);   //全屏在窗口打开后延迟N秒启动
}
/*
function SetCookie(name,value,expires,path,domain,secure)
{
	var expDays = expires*24*60*60*1000;
	var expDate = new Date();
	expDate.setTime(expDate.getTime()+expDays);
	var expString = ((expires==null) ? "" : (";expires="+expDate.toGMTString()));
	var pathString = ((path==null) ? "" : (";path="+path));
	var domainString = ((domain==null) ? "" : (";domain="+domain));
	var secureString = ((secure==true) ? ";secure" : "" );
	document.cookie = name + "=" + escape(value) + expString + pathString + domainString + secureString;
}*/
function GetCookie(name)
{
	var result = null;
	var myCookie = document.cookie + ";";
	var searchName = name + "=";
	var startOfCookie = myCookie.indexOf(searchName);
	var endOfCookie;
	if (startOfCookie != -1)
	{
		startOfCookie += searchName.length;
		endOfCookie = myCookie.indexOf(";",startOfCookie);
		result = unescape(myCookie.substring(startOfCookie, endOfCookie));
	}
	return result;
}
function ClearCookie(name)
{
	var ThreeDays=3*24*60*60*1000;
	var expDate = new Date();
	expDate.setTime(expDate.getTime()-ThreeDays);
	document.cookie=name+"=;expires="+expDate.toGMTString();
}
function DeleteCookie (name) {
    var exp = new Date();
    exp.setTime (exp.getTime() - 1);
    var cval = GetCookie(name);
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
function SetCookie (name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    var CookieStr = name + "=" + escape (value);
    CookieStr += ((expires == null) ? "" : ("; expires=" + exp.toGMTString())) ;
    CookieStr += ((path == null) ? "" : ("; path=" + path));
    CookieStr += ((domain == null) ? "" : ("; domain=" + domain));
    CookieStr += ((secure == true) ? "; secure" : "");
    document.cookie = CookieStr;
}
