﻿function MM_preloadImages() { 
  //v3.0  
  var d=document; 
  if(d.images){ 
     if(!d.MM_p) d.MM_p=new Array();    
	 var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
	 for(i=0; i<a.length; i++)    
	    if (a[i].indexOf("#")!=0){ 
		   d.MM_p[j]=new Image; 
		   d.MM_p[j++].src=a[i];
		}
  }
}
function MM_swapImgRestore() { 
  //v3.0  
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
     x.src=x.oSrc;
}
function MM_findObj(n, d) { 
  //v4.01  
  var p,i,x;  
  if(!d) d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {    
     d=parent.frames[n.substring(p+1)].document; 
	 n=n.substring(0,p);
  }  
  if(!(x=d[n])&&d.all) x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) 
     x=d.forms[i][n];  
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
     x=MM_findObj(n,d.layers[i].document);  
  if(!x && d.getElementById) 
     x=d.getElementById(n); 
  return x;
}
function MM_swapImage() { 
  //v3.0  
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)   
     if ((x=MM_findObj(a[i]))!=null){
	    document.MM_sr[j++]=x; 
		if(!x.oSrc) x.oSrc=x.src; 
		x.src=a[i+2];
	 }
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function isNew(pdatestr){
    var pdatesplit = pdatestr.split('-');
    if(pdatesplit.length>=3){
      var ss = 60*60*24*1000;
      var pdate = new Date(pdatesplit[0],pdatesplit[1]-1,pdatesplit[2]);
      var cdate = new Date();
      var ds = cdate-pdate;
      if(ds/ss<30)
       document.write('<img src="/xslimages/new.gif">');
    }
}


function MM_jumpMenu(targ,selObj,restore,isPopup){ 
  var url = selObj.options[selObj.selectedIndex].value;
  if(isPopup==1){
    open(url, 'popUpWin', 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbar=yes,resizable=yes,copyhistory=yes');  
  }else{    
    //v3.0   
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  }                                                                     
  if (restore) selObj.selectedIndex=0;                                                                      
}                                                                     


function writeCookie(counterid){
	document.cookie = "jcounterid="+counterid; //+";expires="+new Date(new Date().getTime() + 365*24*60*60*1000).toGMTString();    
}

function readCookie(){
	try{
		//判断是否有计数Id号.
		if(document.cookie.indexOf("jcounterid=")<0)
			return '';
		//说明存在计数Id好,则读取出来.
		var cookies,cookieArray2;
		if(document.cookie){
			cookieArray=document.cookie.split(";");
			cookieArray2=new Array();
			for(i in cookieArray){
				cookieArray2[cookieArray[i].split("=")[0].replace(/ /g,"")]=cookieArray[i].split("=")[1].replace(/ /g,"");
			}
		}
		return cookieArray2["jcounterid"];
        }catch(e){}
		return '';
} 
function makeCounterId(){
	var the_date = new Date();
	return ''+the_date.getYear() + the_date.getMonth() + the_date.getDate() + the_date. getHours() + the_date.getMinutes() + the_date.getSeconds() + the_date.getMilliseconds() + (Math.floor(Math.random() * 100000000000) + 1);
} 
function counter(colid,aid){
	var id;
	id = readCookie();
	if(id==''){
		id = makeCounterId();
		writeCookie(id);
	}
	document.write("<div style='display:none;'><img src='http://www.csc360.com:18001/csc360/counter.jsp?sessionid="+id+"&colid="+colid+"&aid="+aid+"&comefrom="+escape(document.referrer)+"&pageurl="+escape(document.URL)+"' border='0' alt='' width='0' height='0'></div>");
}

function openNewWin(url,name,width,height,isScroll,isResize){
	window.open(url,name,'toolbar,'+isResize+','+isScroll+',dependent,width='+width+',height='+height);
}

function showLay(divId, name){
				var objDiv = eval(divId);
				if(divId == "Layer2")
				{
					var objDiv2 = eval("Layer1");
					objDiv2.style.display="none";
					objDiv.style.display="";
					}
				else
				{
					var objDiv2 = eval("Layer2");
					objDiv2.style.display="none";
					objDiv.style.display="";
					}
			return false;
			}

