﻿// JScript 文件
var index =false;
function addIco(){
     var icoLink = document.createElement('link');
     icoLink.href="/fav.ico";
     icoLink.rel="shortcut icon";
     document.documentElement.firstChild.appendChild(icoLink);
}

addIco();//加入ICO图标

function Resize(ImgD,my_w,my_h){ 
 var image=new Image(); 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= my_w/my_h){ 
   if(image.width>my_w){
    ImgD.width=my_w; 
    ImgD.height=(image.height*my_w)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  } 
  else{ 
   if(image.height>my_h){
    ImgD.height=my_h; 
    ImgD.width=(image.width*my_h)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  } 
 }
}

function URLencode(sStr) 
{
    return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
}

function URLdecode(sStr) 
{
    return  unescape(sStr.replace('%2F','/').replace('%27','\'').replace('%22','/"').replace('%2B','+'));
}


function gdw_Loadbar(){
	
	this.top =10;
	this.left =10;
	this.bs =3;
		
	this.init = function(){
	
	    $('#loadbar').remove();
		var htmstr ='';
		htmstr +='<div id="loadbar" style="position:absolute;top:'+this.top+'px;left:'+this.left+'px;z-index:18;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=80,style=0);-moz-opacity: 0.8;">';
		htmstr +='<div style="color:#333333;background-color:#F1F1Ff; border:1px #CCCCCC solid;width:200px;padding:5px;">';
		htmstr +='<div id="l_info">初始化完成.</div>';
		htmstr +='</div>';
		
		$(document.body).append(htmstr);		
	}
	
	this.cinfo= function(ifo){
		$("#l_info").html(ifo);
	}
	
	this.dispose =function(){
	$("#loadbar").fadeOut(1200);
	setTimeout("$('#loadbar').remove();",3000); 
	}
}


var oDiv,oDialog
//建立背景层
function Create_div(bgcolor,alpha)
{
	if($("#oDiv").attr("id")!="oDiv"){
	oDiv = jQuery(document.createElement("div"));
    var ht=document.body.scrollHeight;
	var wh=document.body.clientWidth;
	if(ht<document.body.clientHeight) ht=document.body.clientHeight;
	
	oDiv.css({zIndex: 50, position	: 'absolute',  top	: '0', left: '0', width : ''+wh+'px', height: ''+ht+'px', opacity: ''+alpha+'',  backgroundColor: ''+bgcolor+''	});
	oDiv.attr("id","oDiv");
	jQuery('body').append(oDiv);
	}
}

function oCreate(top,left,w,bgcolor,alpha)
{
	$("#oDialog").remove();
	Create_div(bgcolor,alpha);
    oDialog=jQuery(document.createElement("div"));
	oDialog.attr("id","oDialog");
	
	oDialog.css({zIndex: 100, position	: 'absolute',  top	: ''+top+'', left: ''+left+'',  backgroundColor: '#ffffff'	});
	var dghtm ="<div class='con' style='width:"+w+";border:3px #666666 solid;color:#666666;'>Loading...</div>";
	oDialog.html(dghtm);
	
	jQuery('body').append(oDialog);
	
	var oDDivCon = $("#oDialog .con");
	return oDDivCon;
}


function Loadswf(src,w,h){		 
var html="";
html+='<object codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 width="'+w+'" height="'+h+'" '; 
html+='classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>';
html+='<param name="movie" value="'+src+'">';
html+='<param name="quality" value="high">';
html+='<param name="wmode" value="transparent">';
html+='<embed src="'+src+'" quality="high"  pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" >';
html+='</embed></object>';
return html;
//结束	
}
