function checkBrowser() {
	var ua = navigator.userAgent.toLowerCase();
	var bs = navigator.appName;
	var ver = navigator.appVersion;	

	this.win = false;
	this.mac = false;
	
	if (ua.indexOf('win') >-1 ) {
		this.win = true;
	} else if (ua.indexOf('mac') > -1) {
		this.mac = true;
	}

	this.ie = false;
	this.ns = false;
	this.safari = false;
	
	if (bs == 'Microsoft Internet Explorer') {
		this.ie = true;
	}
	
	if (bs.indexOf('Netscape') != -1) {
		this.ns = true;
	}
	
	if (ver.indexOf('Safari') > 0) {
		this.safari = true;
		this.ns = false;
	}
}

function popwin(url, winName, w, h, isScroll, isResize, hasStatus) {
	var lPos = (screen.width) ? (screen.width - w) / 2 : 0;
	var tPos = (screen.height) ? (screen.height - h + 25) / 2 : 0;
	var settings = 'width=' + w + 'height=' + h + ',left=' + lPos + ',top=' + tPos + ',scrollbars=' + isScroll + ',resizable=' + isResize + ',statusbar=' + hasStatus;

	var win = null;
	win = window.open(url, winName, settings);
}

function trim(str) {
  return str.replace(/^\s+|\s+$/g, '');
}

function isBlank(s) {
	s = trim(s);
  
	if (s!=null && s!="undefined") {

		for (var i = 0; i < s.length; i++) { 	
			var c = s.charAt(i);
			
			if ((c != ' ') && (c != '\n') && (c != '\t')) {
				return false;
			}
		}
	} 
   
	return true;
}

function isDigit(intNum) {
	var digiCount = 0;
	var digiBoundary = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
	intNum += '';

	for(tmpIndex = 0; tmpIndex < intNum.length; tmpIndex++) {
		for(tmpIndex2 = 0; tmpIndex2 < digiBoundary.length; tmpIndex2++) {
			if (intNum.charAt(tmpIndex) == digiBoundary[tmpIndex2])
				digiCount++;
		}		
	}

	if (digiCount == intNum.length)
		return true;
	else
		return false;
}

function isEmail(str) {
	if ( str.length < 1 ) 
    return false;

	if ( (str.indexOf('@') < 1)
    || (str.indexOf('@') != str.lastIndexOf('@'))
    || (str.lastIndexOf('.') < str.indexOf('@') + 2)
    || (str.lastIndexOf('.') > str.length - 3)
    || (str.indexOf('..') > -1)
    || (str.indexOf(' ') >= 0) )
    return false;

	str = str.toLowerCase();
	var strOk = '@._-abcdefghijklmnopqrstuvwxyz0123456789\'';
	for(var i=192; i<208; i++)
	strOk = strOk + String.fromCharCode(i);
	for(var i=209; i<215; i++)
	strOk = strOk + String.fromCharCode(i);
	for(var i=217; i<222; i++)
	strOk = strOk + String.fromCharCode(i);
	for(var i=224; i<247; i++)
	strOk = strOk + String.fromCharCode(i);
	for(var i=249; i<254; i++)
	strOk = strOk + String.fromCharCode(i);
	strOk = strOk + String.fromCharCode(255);

	for ( var i = 0; i < str.length; i++ ) {
		if ( strOk.indexOf(str.charAt(i)) < 0 )
		  return false;
	}

	return true;
}

function writeFlash(swf, width, height, wMode) {
	var flashObj= '';

	flashObj+= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9" width="' + width + '" height="' + height + '">';
		flashObj+= '<param name="movie" value="' + swf + '">';
		flashObj+= '<param name="quality" value="high">';
		flashObj+= '<param name="wmode" value="' + wMode + '">';
			flashObj+= '<embed type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" src="' + swf + '" quality="high" wmode="' + wMode + '" width="' + width + '" height="' + height + '"></embed>';
	flashObj+= '</object>';

	document.write(flashObj);
}

function adjustFrame(go2Top, bapa, anak) {
	if (parent.document.getElementById(bapa) != null && document.getElementById(anak) != null) {
		var oH = parseInt(document.getElementById(anak).offsetHeight);

		/*
		if ( oH < (screen.height / 1.5) ) {
			parent.document.getElementById(bapa).style.height = (screen.height / 1.235);
		} else {
			parent.document.getElementById(bapa).style.height = oH + 25;
		}
		*/

		if (oH < 325) {
			parent.document.getElementById(bapa).style.height = oH + 325;
		} else {
			parent.document.getElementById(bapa).style.height = oH + 25;
		}

		if (go2Top == 1) { parent.scrollTo(0, 0); }
	}
}

function digitRound(inputDigit, decimalPoint) {
	var tmpDecimal = '';

	for (var tmpIndex = 0; tmpIndex < decimalPoint; tmpIndex++) {
		tmpDecimal += '0';
	}

	inputDigit = parseFloat(inputDigit);
	inputDigit = Math.round(inputDigit * 100.0) / 100.0;
	inputDigit = inputDigit + '';

	if (inputDigit.indexOf('.') == -1) {
		if (decimalPoint > 0) {
			inputDigit = inputDigit + '.' + tmpDecimal;
		}
	}

	return inputDigit;		
}

/* ----------------------------------------------------------------------------------------------------
 * Others
 */
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

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

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}