function NewPage(url,name,w, h) 
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var windowprops = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no" +
",left=" + winl + ",top=" + wint + ",width=" + w + ",height=" + h;
	var popup = window.open(url,name,windowprops);
	if ((document.window != null) && (!popup.opener)) {
		popup.opener = document.window;
	}	
}
function NewPage2(url,name,w, h) 
{
var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var windowprops = "location=yes,scrollbars=yes,menubars=yes,toolbars=yes,resizable=yes,status=yes" +
",left=" + winl + ",top=" + wint + ",width=" + w + ",height=" + h;
	var popup = window.open(url,name,windowprops);
	if ((document.window != null) && (!popup.opener)) {
		popup.opener = document.window;
	}	
}

function get_random()
{
    //var ranNum= Math.floor(Math.random()*5);
	var ranNum= Math.random();
    return ranNum;
}

function randomLetter()
{
   return String.fromCharCode(97 + Math.round(Math.random() * 25));
}

// Function Name: trim
// Function Description: 去除字符串的首尾的空格
// Creation Date: 2004-7-13 15:30
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.trim=function(){
return this.replace(/(^\s*)|(\s*$)/g, "");
}

// Function Name: ltrim
// Function Description: 去除字符串的左?的空格
// Creation Date: 2004-7-13 9:58
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.ltrim=function()
{
return this.replace(/(^\s*)/g, "");
}

// Function Name: rtrim
// Function Description: 去除字符串的右?的空格
// Creation Date: 2004-7-13 15:31
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.rtrim=function()
{
return this.replace(/(\s*$)/g, "");
}

// Function Name: len
// Function Description: 返回字符串的???度, 一??字算2??度
// Creation Date: 2004-7-13 9:58
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.len=function()
{
var str=this;
return str.replace(/[^\x00-\xff]/g, "**").length
}

// Function Name: isValidDate
// Function Description: 判??入是否是有效的短日期格式 - "YYYY-MM-DD"
// Creation Date: 2004-7-13 9:58
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidDate=function()
{
var result=this.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
if(result==null) return false;
var d=new Date(result[1], result[3]-1, result[4]);
return (d.getFullYear()==result[1]&&d.getMonth()+1==result[3]&&d.getDate()==result[4]);
}

// Function Name: isValidTime
// Function Description: 判??入是否是有效的??格式 - "HH:MM:SS"
// Creation Date: 2004-7-13 9:58
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidTime=function()
{
var resule=this.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/);
if (result==null) return false;
if (result[1]>24 || result[3]>60 || result[4]>60) return false;
return true;
}

// Function Name: isValidEmail
// Function Description: 判??入是否是有效的?子?件
// Creation Date: 2004-7-13 9:59
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidEmail=function()
{
var result=this.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/);
if(result==null) return false;
return true;
}

// Function Name: isValidDatetime
// Function Description: 判??入是否是有效的?日期格式 - "YYYY-MM-DD HH:MM:SS"
// Creation Date: 2004-7-13 9:59
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidDatetime=function()
{
var result=this.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/);
if(result==null) return false;
var d= new Date(result[1], result[3]-1, result[4], result[5], result[6], result[7]);
return (d.getFullYear()==result[1]&&(d.getMonth()+1)==result[3]&&d.getDate()==result[4]&&d.getHours()==result[5]&&d.getMinutes()==result[6]&&d.getSeconds()==result[7]);
}

// Function Name: isValidInteger
// Function Description: 判??入是否是一?整?
// Creation Date: 2004-7-13 10:01
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidInteger=function()
{
var result=this.match(/^(-|\+)?\d+$/);
if(result==null) return false;
return true;
}

// Function Name: isValidPositiveInteger
// Function Description: 判??入是否是一?正整?
// Creation Date: 2004-7-13 10:01
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidPositiveInteger=function()
{
var result=this.match(/^\d+$/);
if(result==null) return false;
if(parseInt(this)>0) return true;
return false;
}

// Function Name: isValidNegativeInteger
// Function Description: 判??入是否是一??整?
// Creation Date: 2004-7-13 10:28
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidNegativeInteger=function()
{
var result=this.match(/^-\d+$/);
if(result==null) return false;
return true;
}

// Function Name: isValidNumber
// Function Description: 判??入是否是一??字
// Creation Date: 2004-7-13 10:01
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidNumber=function()
{
return !isNaN(this);
}

// Function Name: isValidLetters
// Function Description: 判??入是否是一?由 A-Z / a-z ?成的字符串
// Creation Date: 2004-7-13 10:10
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidLetters=function()
{
var result=this.match(/^[a-zA-Z]+$/);
if(result==null) return false;
return true;
}

// Function Name: isValidDigits
// Function Description: 判??入是否是一?由 0-9 ?成的?字
// Creation Date: 2004-7-13 10:10
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidDigits=function()
{
var result=this.match(/^[0-9][0-9]+$/);
if(result==null) return false;
return true;
}

// Function Name: isValidAlphanumeric
// Function Description: 判??入是否是一?由 0-9 / A-Z / a-z ?成的字符串
// Creation Date: 2004-7-13 10:14
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidAlphanumeric=function()
{
var result=this.match(/^[a-zA-Z0-9]+$/);
if(result==null) return false;
return true;
}

// Function Name: isValidString
// Function Description: 判??入是否是一?由 0-9 / A-Z / a-z / . / _ ?成的字符串
// Creation Date: 2004-7-13 10:20
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidString=function()
{
var result=this.match(/^[a-zA-Z0-9\s.\-_]+$/);
if(result==null) return false;
return true;
}

// Function Name: isValidPostalcode
// Function Description: 判??入是否是一?有效的?政??
// Creation Date: 2004-7-13 10:22
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidPostalcode=function()
{
var result=this.match(/(^[0-9]{6}$)/);
if(result==null) return false;
return true;
}

// Function Name: isValidPhoneNo
// Function Description: 判??入是否是一?有效的????
// Creation Date: 2004-7-13 10:22
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidPhoneNo=function()
{
var result=this.match(/(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)/);
if(result==null) return false;
return true;
}

// Function Name: isValidMobileNo
// Function Description: 判??入是否是一?有效的手机??
// Creation Date: 2004-7-13 10:23
// Last Modify By: N/A
// Last Modify Date: N/A
String.prototype.isValidMobileNo=function()
{
var result=this.match(/(^0{0,1}13[0-9]{9}$)/);
if(result==null) return false;
return true;
}


function mecboardClose(){
	$('mecboardOpen').hide();
}
function mecboardOpen(num){
	$('mecboardOpen').show();		
	for (var i = 1; i<=7; i++){
		$('mecboard_'+i).hide();
	}	
	$('mecboard_'+num).show();
}
function mecboardOpen1(){
	$('mecboard_head').innerHTML='<img src="images/corporate_govern/management_head1.jpg">';
	$('mecboard_name').innerHTML = "SIMON";
	$('mecboard_title').innerHTML = "Chairman";
	$('mecboard_desc').innerHTML = "Mr. Lo";
}
function OCClose(){
	$('org_chart').hide();
}
function openLevel(num){	
	$('org_chart').show();	
	for (var i = 0; i<=4; i++){
		$('level_'+i).hide();
	}	
	$('level_'+num).show();
	switch(num){
		case 0:
			$('org_chart').style.marginTop = "0px";
			break;
		case 1:
			$('org_chart').style.marginTop = "100px";
			break;
		case 2:
			$('org_chart').style.marginTop = "200px";
			break;
		case 3:
			$('org_chart').style.marginTop = "300px";
			break;
		case 4:
			$('org_chart').style.marginTop = "400px";
			break;
		default:
			$('org_chart').style.marginTop = "0px";
			break;
	}
}

function changeImg(id, imgpath){
	$(id).src=imgpath;
}
