<!--//

var strCfgAjaxLoaderImage		=	"/images/icon/ajax-loader.gif";
var strCfgAjaxLoaderImageBig	=	"/images/icon/ajax-loader-big.gif";


function PopUpWindow(URL, N, W, H, S) { // name, width, height, scrollbars
	var winleft	=	(screen.width - W) / 2;
	var winup	=	(screen.height - H) / 2;
	winProp		=	'width='+W+',height='+H+',left='+winleft+',top='+winup+',scrollbars='+S+',resizable' + ',status=yes'
	Win			=	window.open(URL, N, winProp)
	if (parseInt(navigator.appVersion) >= 4) { Win.window.focus(); }
}



function confirmBox(strUrl) {
	PopUpWindow(strUrl,'SHConfirmBox',500,150,'no');
}


function alphaCheck(objTextField,strDefaultValue) {
	var Sender	=	objTextField.value;
	var alphaRE = /^[a-zA-Z0-9]+$/;
	if (!alphaRE.test(Sender) && Sender != ""){
		alert("only a-z, A-Z, 0-9");
		objTextField.value = strDefaultValue;
	}
}


function setFormValue(objName,strValue){
/* by LookHin (khwanchai1979 [at] hotmail.com) */
	var arrObj = document.getElementsByName(objName);
	for(i=0;i<arrObj.length;i++){
		arrObjCheck = arrObj[i];
		if(arrObjCheck.type == "text" || arrObjCheck.type == "textarea" || arrObjCheck.type == "hidden") arrObjCheck.value = strValue;
		if(arrObjCheck.type == "select-one") for(j=0;j<arrObjCheck.length;j++) if(arrObjCheck.options[j].value == strValue) arrObjCheck.options[j].selected = true;
		if(arrObjCheck.type == "select-multiple") for(j=0;j<arrObjCheck.length;j++) if(strValue.indexOf("|"+arrObjCheck.options[j].value+"|")  > -1) arrObjCheck.options[j].selected = true;
		if(arrObjCheck.type == "radio") if(arrObjCheck.value == strValue) arrObjCheck.checked = true;
		if(arrObjCheck.type == "checkbox") if(arrObjCheck.value == strValue) arrObjCheck.checked = true;
	}
}



function jumpMenu(targ,selObj,restore){   
	if (selObj.options[selObj.selectedIndex].value != "") {
		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
		if (restore) selObj.selectedIndex=0;
	}
}

function replaceString (strString,strFind,strReplace) {
	while (strString.indexOf(strFind)>-1) {
		intPosition= strString.indexOf(strFind);
		strString = "" + (strString.substring(0, intPosition) + strReplace + 
		strString.substring((intPosition + strFind.length), strString.length));
	}
	return strString;
}


var httpRequest = false;
function makeRequest(url) {
	httpRequest = false;

	if (window.XMLHttpRequest) { // Mozilla, Firefox, Opera, etc. 
		httpRequest = new XMLHttpRequest();
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
			httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!httpRequest) {
		alert('Cannot create an XMLHTTP instance');
		return false;
	}
	httpRequest.onreadystatechange = getContents;
	httpRequest.open('GET', url, true);
	httpRequest.send(null);
}

/*
function getContents() {
	if (httpRequest.readyState == 4) {
		if (httpRequest.status == 200) {
			var xmlDoc = httpRequest.responseXML;

			if (window.ActiveXObject) { // IE
				var strData1 = xmlDoc.getElementsByTagName("root")[0].childNodes.item(0).childNodes.item(0);
			}
			else { // Mozilla, Firefox, Opera, etc. 
				var strData1 = xmlDoc.getElementsByTagName("root")[0].childNodes.item(1).childNodes.item(0);
			}
			document.getElementById('divRoundId').innerHTML = strData1.data;
		}
		else {
			alert('There was a problem with the request.');
		}
	}
}
*/

function setDiv (strDivName,strDivData) {
	document.getElementById(strDivName).innerHTML = strDivData;
}

function getDiv (strDivName) {
	return document.getElementById(strDivName).innerHTML;
}

function clearDiv (strDivName) {
	document.getElementById(strDivName).innerHTML = '';
}

function hideDiv (strDivName) {
	document.getElementById(strDivName).style.display = 'none';
}

function showDiv (strDivName) {
	document.getElementById(strDivName).style.display = '';
}

function showAjaxLoader (strDivName) {
	document.getElementById(strDivName).innerHTML = '<img src="'+ strCfgAjaxLoaderImage +'" align="absmiddle" border="0">';
}

function showAjaxLoaderBig (strDivName) {
	document.getElementById(strDivName).innerHTML = '<img src="'+ strCfgAjaxLoaderImageBig +'" align="absmiddle" border="0">';
}

function getDivDisplay (strDivName) {
	return document.getElementById(strDivName).style.display;
}

var intIDivTemp = 0;
function setDivTemp () {
	intIDivTemp++;
	return "divTemp" + intIDivTemp;
}

function preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=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];}}
}

preloadImages(strCfgAjaxLoaderImage,strCfgAjaxLoaderImageBig);


















function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}


// this function gets the cookie, if it exists
function Get_Cookie( name ) {
	
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
	
// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

/*
<script type="text/javascript">
Set_Cookie( 'test', 'it works', '', '/', '', '' );
if ( Get_Cookie( 'test' ) ) alert( Get_Cookie('test'));
Delete_Cookie('test', '/', '');
( Get_Cookie( 'test' ) ) ? alert( Get_Cookie('test')) : 
alert( 'it is gone');
</script>
*/


//-->
