
function open_popup(url, wid, hei, scroll, winName)
{
	var leftp=(screen.width)?(screen.width-wid)/2:100;
	var topp=(screen.height)?(screen.height-hei)/2:100;
	var posi = "width="+ wid +",height="+hei+",toolbar=no,location=no,status=no,menubar=no,top="+topp+",left="+leftp+",scrollbars=" + scroll +",resizable=no" ;
	if (winName == "")
	{
		winName = "popup"
	}
	window.open(url,winName,posi);
}


function full_popup(url_txt)
{
	var  dimentions_and_such1 = 'fullscreen=1,scrollbars=0';
	Pop=window.open(url_txt,'',dimentions_and_such1);   
}


function findImgUrl(str)
{
	var oldImgUrl = document.images[str].src;
	var findText = "/";
	var findTextNum = oldImgUrl.lastIndexOf(findText) + 1;
	return(oldImgUrl.substring(0,findTextNum));
}

function imgOver(imgName)
{
		newImgUrl = findImgUrl(imgName);
		document.images[imgName].src = newImgUrl + imgName + "on.gif";
}

function imgOut(imgName)
{
		newImgUrl = findImgUrl(imgName);
		document.images[imgName].src = newImgUrl + imgName + "off.gif";
}

function isNumeric(field)
{
var valid = "0123456789.";
var ok = "yes"; 
var temp; 
	for (var i=0; i<field.value.length; i++) 
	{ 
		temp = "" + field.value.substring(i, i+1); 
		if (valid.indexOf(temp) == "-1"){
			ok = "no"; 
			break;
		}
	} 
	
	if (ok == "no") 
	{ 			
		return false;
	}  
	
	return true;
}

function checkemail(checktextbox)
{
		
	var checkword = checktextbox.value.toLowerCase(); 
	
	var isok = 1;
	
	if (checktextbox.value.indexOf("@") + "" == "-1" || checktextbox.value.indexOf(".") + "" == "-1")
	{
		alert('กรุณาใส่ อีเมลล์ ให้ถูกต้องด้วยค่ะ');
		isok = 0;
	}
	
	if(isok == 0)
	{
		checktextbox.value = "";
		checktextbox.focus();
		return false;
	}
	else
	{
		return true;
	}
	
} 

function isalphanumeric(getword)
{
var alphanumeric = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

var i ;
var t = getword.value ;
for ( i=0; i<t.length; i++ )
if( alphanumeric.indexOf(t.substring(i,i+1)) <0){
break;
}

if ( i !=t.length )
{
	return false;
} 

return true ; 

}

function isalphabet(getword)
{
var alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

var i ;
var t = getword.value ;
t = t.substring(0,1);
for ( i=0; i<t.length; i++ )
if( alphabet.indexOf(t.substring(i,i+1)) <0){
break;
}

if ( i !=t.length )
{
	return false;
} 

return true ; 

}

function GetCheckedValue(component)
{	
	for (var i = 0; i < component.length; i++)
		if (component[i].checked)
			return component[i].value;

	if(component.checked)
		return component.value;

	
	return '';	
}

function showMovieObject(objID, objSource, objWidth, objHeight, objWmode)
{
	//page url
	var pageUrl = self.window.location.href;
	if(pageUrl.substring(0,5) == 'https') {
		swfUrl = "https";
	} else {
		swfUrl = "http";
	}
	/* Default Value Setting */
	if (objID == "") objID = 'mv1';
	if (objWidth == "") objWidth = '0';
	if (objHeight == "") objHeight = '0';
	if (objWmode == "") {
		objWmode = 'false';
	}
	
	document.write('<OBJECT id="' + objID + '" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"');
	document.write('type="application/x-oleobject" ');
	document.write('codebase=' + swfUrl +'"://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" ');
	document.write('standby="Loading Microsoft Windows Media Player components..." ');
	document.write('WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '">');	
	document.write('<PARAM NAME=ShowStatusBar value=true>');
	document.write('<PARAM NAME=transparent value=true>');
	document.write('<PARAM NAME=url value="'+ objSource +'">');
	document.write('<PARAM NAME=autostart VALUE="'+ objWmode +'">');
	document.write('<PARAM NAME=volume VALUE=50>');
	document.write('</OBJECT>');

}

function showFlashObject(objID, objSource, objWidth, objHeight, objWmode)
{
	//page url
	var pageUrl = self.window.location.href;
	if(pageUrl.substring(0,5) == 'https') {
		swfUrl = "https";
	} else {
		swfUrl = "http";
	}
	/* Default Value Setting */
	if (objID == "") objID = 'flash1';
	if (objWidth == "") objWidth = '0';
	if (objHeight == "") objHeight = '0';
	if (objWmode == "") {
		objWmode = 'false';
	}
	
	document.write('<OBJECT id="' + objID + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('type="application/x-shockwave-flash" ');
	document.write('codebase=' + swfUrl +'"://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0" ');	
	document.write('WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '">');	
	document.write('<PARAM NAME=movie value="' +objSource+'">');
	document.write('<PARAM NAME=quality value=high>');
	document.write('<PARAM NAME=wmode value='+ objWmode +'>');
	document.write('<EMBED src="' +objSource+'" quality=high wmode='+ objWmode +' width='+objWidth +' HEIGHT='+objHeight+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	document.write('</EMBED>');
	document.write('</OBJECT>');

}
