// JavaScript Document
// Author     : BlueCharm

//===================================================================================================
//转到已经打开窗口，否则打开新页面！
function FocusTo(URL)
{
    if(typeof(window.opener.name)!='unknown')
	{
        window.opener.location=URL;
        window.opener.focus();              
    }
    else{                       
        window.open(URL);
        window.focus();
    }   
}
//===================================================================================================

//===================================================================================================
//检查日期！
function IsDate(datestr)  
{  
    var  myDatestr = datestr+""; 
    var  aryDate   = myDatestr.split('-'); 
    if  (aryDate.length!=3) return true;    
    var  myYear   = parseInt(aryDate[0]);  
    var  myMonth  = parseInt(aryDate[1]); 
    var  myDay    = parseInt(aryDate[2]); 
    if  ((aryDate[0].length!=4) || (aryDate[1].length>2) || (aryDate[2].length>2)) return true;  
    if  ((aryDate[1].length<1) || (aryDate[2].length<1)) return true;  
    if  (isNaN(myYear) || isNaN(myMonth) || isNaN(myDay)) return true;  
    if  ((myMonth>12) || (myMonth<1)) return true;  
    if  (myDay<1 || myDay>31) return true;
	return false;  
}
//===================================================================================================

//===================================================================================================
//Procedure   : IsMail
//Description : Check the Object is Email or not !
//Parameter   : mail - The Object be Checked!
//Return      : Boolean
function IsMail(mail) 
{ 
    var RegularExpressions = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
    if (!RegularExpressions.test(mail)) return true ; else return false; 
}
//===================================================================================================


//===================================================================================================
//Procedure   : IsOkStr
//Description : Check the String for username or password !
//Parameter   : str - The Object be Checked , l - the length of Object!
//Return      : Boolean
function IsOkStr(str,l) 
{ 
    var strInStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
	if (str.length<l){ return true; }
	else
	{
		for (var i = 0 ; i < str.length ; i++)
		{
			ch = str.charAt(i);
			for (j = 0; j < strInStr.length; j++){if(ch==strInStr.charAt(j)){break;}}
			if  (j == strInStr.length) return true;
		}
		return false;
	}	
}
//===================================================================================================


//===================================================================================================
//Procedure   : Flash
//Description : Show Flash !
//Parameter   : ur - url , w - witdh , h - height !
//Return      : 
function Flash(ur,w,h){
    document.write('<object id="myFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" \
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" \
	width="'+w+'" height="'+h+'"> \
	<param name="movie" value="' + ur + '"> \
	<param name="quality" value="high"> \
	<param name="wmode" value="transparent"> \
	<param name="menu" value="false"> \
	<embed src="' + ur + '" quality="high" \
	 pluginspage="http://www.macromedia.com/go/getflashplayer" \
	 type="application/x-shockwave-flash" wmode="transparent" \
	width="'+w+'" height="'+h+'"></embed></object> ');
}
//===================================================================================================


//===================================================================================================
//Procedure   : Roll
//Description : srolling level !
//Parameter   : w - width, c - the content of show
//Return      : 
function RollL(w,c)
{
    dcoument.write("<DIV id='roll' style='overflow:hidden; width:230px'>");
    dcoument.write("<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0>");
	dcoument.write("<TBODY><TR><TD id='rollleft' align='middle'>");
    dcoument.write("<TABLE cellSpacing=0 cellPadding=0 border=0>");
    dcoument.write("<TBODY><TR><TD noWrap> "+c+" </TD></TR></TBODY>")
	dcoument.write("</TABLE></TD><TD id='rollright'></TD></TR></TBODY>")
	dcoument.write("</TABLE></DIV>");
	
	var speed=20;
    rollright.innerHTML=rollleft.innerHTML;
    function Marquee()
	{
		if ( rollright.offsetWidth-roll.scrollLeft<=0 ) 
		{   roll.scrollLeft-=rollleft.offsetWidth;    }
		else
		{   roll.scrollLeft++ ;  }
    }
    var MyMar=setInterval(Marquee,speed)
    roll.onmouseover=function() { clearInterval(MyMar); };
    roll.onmouseout =function() { MyMar=setInterval(Marquee,speed); };
}


function RollH(w,c)
{
	document.write("<div id=design style='OVERFLOW: hidden; WIDTH: 150px; HEIGHT: 230px'> \
                        <div id=design1 style='OVERFLOW: hidden'><!--内容--></div> \
                        <div id=design2></div> \
                    </div>")
    var speed = 65 ;
    design2.innerHTML = design1.innerHTML ;
	
    function Marquee2()
	{
        if(design2.offsetTop-design.scrollTop<=0)
        {
			design.scrollTop-=design1.offsetHeight;
		}
        else{
			design.scrollTop++ ; 
		}
     }
     var MyMar2=setInterval(Marquee2,speed)
     design.onmouseover=function() {clearInterval(MyMar2)}
     design.onmouseout=function() {MyMar2=setInterval(Marquee2,speed)}
}
//===================================================================================================