﻿function checkEmpty(str)
{
    if ( str != "" )
    {
        return true;
    }
    else
    {
	return false;
    }
}

function checkStr(str)
{
    var chkstr="-~!@#$%^&*();'\"?><[]{}\\|,:/=+—“”‘’";
    for( i=0; i<str.length; i++)
    {
        if(chkstr.indexOf(str.charAt(i))!=-1)
        {
            return false;
        }
    }
    return true;
}

function checkSafe(str)
{
    var chkstr="-%^*();'\"{}\\:/";
    for( i=0; i<str.length; i++)
    {
        if(chkstr.indexOf(str.charAt(i))!=-1)
        {
            return false;
        }
    }
    return true;
}

function checkPwd(str)
{
    var chkstr="-'\"“”‘’";
    for(i=0;i<str.length;i++)
    {
        if(chkstr.indexOf(str.charAt(i))!=-1)
        {
            return false;
        }
    }
    return true;
}

function checkNum(num)
{
    var chkstr = /^[0-9]/;
    if ( chkstr.test(num) )
    {
        return true;
    }
    else
    {
	return false;
    }
}

function checkTelphone(num)
{
    var chkstr = "0123456789-+";
    for(i=0;i<num.length;i++)
    {
        if(chkstr.indexOf(num.charAt(i))==-1)
        {
            return false;
        }
    }
    return true;
}

function checkEmail(str)
{
    var chkstr =/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
    if ( chkstr.test(str) )
    {
        return true;
    }
    else
    {
        return false;
    }
}

function checkMaxLen(str, maxlen)
{
	if ( str.length<=maxlen )
	{
		return true;
	}
	else
	{
		return false;
	}
}

function checkMinLen(str, minlen)
{
	if ( str.length>=minlen )
	{
		return true;
	}
	else
	{
		return false;
	}
}

function isChinese(str)
{
	var chkstr=/[^\x00-\xff]/g;
	if ( !chkstr.test(str) )
	{
		return true;
	}
	else
	{
		return false;
	}
}

//function tick() 
//{ 
//	var hours, minutes, seconds, xfile; 
//	var intHours, intMinutes, intSeconds; 
//	var today; 
//
//	today = new Date(); 
//	intHours = today.getHours(); 
//	intMinutes = today.getMinutes(); 
//	intSeconds = today.getSeconds(); 
//
//	if (intHours == 0) 
//	{ 
//		hours = "12:"; 
//		xfile = "午夜"; 
//	} 
//	else if (intHours < 12) 
//	{ 
//		hours = intHours+":"; 
//		xfile = "上午"; 
//	} 
//	else if (intHours == 12) 
//	{ 
//		hours = "12:"; 
//		xfile = "正午"; 
//	} 
//	else 
//	{ 
//		intHours = intHours - 12 
//		hours = intHours + ":"; 
//		xfile = "下午"; 
//	} 
//
//	if (intMinutes < 10) 
//	{ 
//		minutes = "0"+intMinutes+":"; 
//	} 
//	else 
//	{ 
//		minutes = intMinutes+":"; 
//	} 
//
//	if (intSeconds < 10) 
//	{ 
//		seconds = "0"+intSeconds+" "; 
//	} 
//	else 
//	{ 
//		seconds = intSeconds+" "; 
//	}
//	
//	timeString = xfile+hours+minutes+seconds; 
//	document.getElementById("t").innerHTML=timeString 
//	window.setTimeout("tick();", 1000); 
//} 
//window.onload=tick;
function insertFlash(elm, url, w, h, id, module) 
{
	if (!document.getElementById(elm)) return;
	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="FlashVars" value="id='+id+'" />';
	str += '<param name="wmode" value="opaque">';
	str += '<param name="quality" value="autohigh">';
	str += '<embed width="'+ w +'" height="'+ h +'" src="'+ url +'" quality="autohigh" FlashVars="id='+id+'" wmode="opaque" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
	str += '</object>';

	if ( module=='normal' )
	{
		var notice = '<img src="/images/Notice.gif" border="0"> 请点击上面的按钮开始播放 <span onclick="insertFlash(\'Player\', \''+url+'\', 450, 350, '+id+', \'min\');">小窗口播放</span>　　<a href="./PlayerPro.php?id='+id+'" target="_blank">大窗口播放</a></div>';
		document.getElementById(elm).innerHTML = str;
		document.getElementById('PlayNotice').innerHTML = notice;
			//document.getElementById('PlayerRight').style.display='block';
	}
	else if( module=='min' )
	{
		var notice = '<div id="PlayModule2"><span onclick="insertFlash(\'Player\', \''+url+'\', 550, 450, '+id+', \'normal\');">正常窗口播放</span>　　<a href="./PlayerPro.php?id='+id+'" target="_blank">大窗口播放</a></div>';
		document.getElementById(elm).innerHTML = str;
		document.getElementById('PlayNotice').innerHTML = notice;
		document.getElementById('PlayerRight').style.display='block';
	}
	else if ( module=='max' )
	{
		str = '<div id="MaxPlayer">'+str+'</div>';
		document.getElementById(elm).innerHTML = str;
		document.getElementById('PlayNotice').innerHTML = notice;
		document.getElementById('PlayerRight').style.display='none';
	}
}

function Show_Menu(tdid_num,tdnum,num,onclass,offclass){
	for(var i=0;i<num;i++){
		document.getElementById("tdcontent_"+tdid_num+i).style.display="none";
	}
	for(var i=0;i<num;i++){
		document.getElementById("tdmenu_"+tdid_num+i).className=offclass;
	}
	document.getElementById("tdmenu_"+tdid_num+tdnum).className=onclass;
	document.getElementById("tdcontent_"+tdid_num+tdnum).style.display="block";
}
