﻿$(document).ready(function (){
    $("#IsContent img").each(function (){
        changeImgSize(this);
    });
/*
    OtherRightObj = document.getElementById("OtherRight");
	OtherRightObj.style.right = "0px" ;
	OtherRightObj.style.left = getDivMenuLeft1(872,874);
	OtherRightObj.style.display = "";
	moveRightEdge("OtherRight");
*/
}); 
//-----------------------------------------------------------------------
//正文图片载入大小限制
function changeImgSize(obj)
{
	var maxImageWidth = 500;	//图片的最大宽度
	$(obj).css("cursor","pointer");

	if($(obj).attr("width") > maxImageWidth)
	{
		$(obj).attr("width",maxImageWidth);
		$(obj).css("width",maxImageWidth);
	}
	
	if (!$(obj).parent().is("a"))
	{
	    $(obj).attr("alt","按此在新窗口浏览图片");
	    $(obj).bind("click",function(){window.open(obj.src);});
	}
}
//-----------------------------------------------------------------------
//免激活方式显示FLASH
function insertFlash(url, w, h) { 
var str = ''; 
str += '<object width="'+ w +'" height="'+ h +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">'; 
str += '<param name="movie" value="'+ url +'">'; 
str += '<param name="wmode" value="transparent">'; 
str += '<param name="quality" value="autohigh">'; 
str += '<embed width="'+ w +'" height="'+ h +'" src="'+ url +'" quality="autohigh" wmode="transparent" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>'; 
str += '</object>'; 
document.write(str); 
}
//-----------------------------------------------------------------------
function CheckInput(ID,Str,DefauleValue)
{
    if ($.trim($('#'+ID).attr("value"))=="")
    {
        alert(Str);
        $('#'+ID).focus();
        return false;
    }
    if (DefauleValue)
    {
        if ($.trim($('#'+ID).attr("value"))==DefauleValue)
        {
            alert(Str);
            $('#'+ID).focus();
            return false;
        }
    }
    return true;
}
//-----------------------------------------------------------------------
function ShowSearch()
{
    if (CheckInput("Key","请输入搜索关键字！"))
        return true;
    else
        return false;
}
//-----------------------------------------------------------------------
function ShowChild(e)
{
    $(e).parent().find("ul").show();
}
function HideChild(e)
{
    $(e).parent().find("ul").hide();
}
//-----------------------------------------------------------------------
	function moveRightEdge(ObjName) {
		var Obj = document.getElementById(ObjName);
		var yMenuTo = GetScrollTop();
		timeoutNextCheck = 20;
		Obj.style.marginTop =  yMenuTo + "px";
		setTimeout('moveRightEdge("'+ ObjName + '")',timeoutNextCheck);	
	}

	var w3c=(document.getElementById)? true: false;
	var agt=navigator.userAgent.toLowerCase();
	var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
	function IeTrueBody(){
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
	}
	function GetScrollTop(){
		return ie ? IeTrueBody().scrollTop : window.pageYOffset;
	}

    function getPageSize(){  
	    return (window.screen.width - 20)
	}

    function getDivMenuLeft1(IeNem,FfNem){
		if(window.navigator.userAgent.indexOf("MSIE")!=-1){
			DivMenuLeft = ((getPageSize() -952)/2 + IeNem) + "px" ;
		}
		else if(window.navigator.userAgent.indexOf("Firefox")!=-1){
			DivMenuLeft = ((getPageSize() -952)/2 + FfNem) + "px" ;
		}
		return DivMenuLeft;
	}
	
	function CloseQQ()
	{
	    $("#OtherRight").hide();
	}