 
Request.HTML.implement({
 
    processHTML: function(text){
        var match = text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
        text = (match) ? match[1] : text;
           
        var container = new Element('div');
           
        return $try(function(){
        var root = '<root>' + text + '</root>', doc;
            doc = new DOMParser().parseFromString(root, 'text/html');
            root = doc.getElementsByTagName('root')[0];
            for (var i = 0, k = root.childNodes.length; i < k; i++){
                var child = Element.clone(root.childNodes[i], true, true);
                if (child) container.grab(child);
            }
            return container;
        }) || container.set('html', text);
    }
   
});
 
 

function disablebtn(prm) {
		document.getElementById(prm).disabled = "disabled";
	}
	function regjx() {
		if (document.userform.user.value == "") {
			alert("Email tidak boleh kosong.");
		}else if (document.userform.pass.value == "") {
			alert("Password tidak boleh kosong.");
		}else if (document.userform.pass.value != document.userform.pass1.value) {
			alert("Password dan Konfirmasi Password tidak sama.");
		}else if (document.userform.nama.value == "") {
			alert("Nama tidak boleh kosong.");
		}else{
			var req = new Request.HTML({
				method: 'post',
				url: 'dsp_postreg.php',
				update: $('postreg')
			}).send($('userform'));	
		}
	}
	function komenjx() {
		if (document.komenfrm.komentar.value == "") {
			alert("Komentar tidak boleh kosong.");
		}else{
			var req = new Request.HTML({
				method: 'post',
				url: 'dsp_postkomen.php',
				update: $('komendiv')
			}).send($('komenfrm'));	
		}
	}
	function showLoading(div){
		divObj = $(div);
		img = new Element('img', {'src': 'images/loading.gif', 'styles': {'position':'absolute', 'width': 32, 'height': 32, 'left':'50%','top':'50%', 'marginLeft':'-16px', 'marginTop':'-16px'}}).injectInside(divObj);
	}	
	function ceknama() {
		if (document.userform.nama.value == "") {
			alert("Nama tidak boleh kosong.");
		}else{
			var req = new Request.HTML({
				method: 'get',
				url: 'dsp_ceknama.php',
				data : {'nama':$('nama').value},
				update: $('postreg')
			}).send();	
		}
	}
	function gallpage(page,sid) {
		var req = new Request.HTML({
			method: 'get',
			url: 'gallpaging.php',
			data : {'page':page,'sid':sid},
			onRequest : showLoading('thumbgal'),
			update: $('thumbgal')
		}).send();	
	}
	function galerictn(page,sid) {
		var req = new Request.HTML({
			method: 'get',
			url: 'galeripaging.php',
			data : {'page':page,'sid':sid},
			onRequest : showLoading('thumbgal'),
			update: $('thumbgal')
		}).send();	
	}	
	function galerikmn(sid) {
		var req = new Request.HTML({
			method: 'get',
			url: 'dsp_komentar.php',
			data : {'sid':sid},
			onRequest : showLoading('ntctn'),
			update: $('ntctn')
		}).send();	
	}	
	function gallctn(page,sid) {
		var myGal=new Array();
		myGal['dtype']="8";
		myGal['gtype']="9";
		myGal['vtype']="10";
		var curr = '';
		
		if (sid == 'dtype') {
			if ($('dtype').alt == 'on') {$('dtype').alt = 'off';$('dtype').src = 'images/ico_gal'+myGal[sid]+'.jpg';}else{$('dtype').alt = 'on';$('dtype').src = 'images/spacer.gif';}
		}
		if (sid == 'gtype') {
			if ($('gtype').alt == 'on') {$('gtype').alt = 'off';$('gtype').src = 'images/ico_gal'+myGal[sid]+'.jpg';}else{$('gtype').alt = 'on';$('gtype').src = 'images/spacer.gif';}
		}
		if (sid == 'vtype') {
			if ($('vtype').alt == 'on') {$('vtype').alt = 'off';$('vtype').src = 'images/ico_gal'+myGal[sid]+'.jpg';}else{$('vtype').alt = 'on';$('vtype').src = 'images/spacer.gif';}
		}

		if ($('dtype').alt == 'on') curr = curr + myGal['dtype'] + ',';
		if ($('gtype').alt == 'on') curr = curr + myGal['gtype'] + ',';
		if ($('vtype').alt == 'on') curr = curr + myGal['vtype'] + ',';
		curr = curr.substring(0,curr.length-1)
		var req = new Request.HTML({
			method: 'get',
			url: 'dsp_galeripost.php',
			data : {'page':page,'sid':curr},
			onRequest : showLoading('fotoctnhome'),
			update: $('fotoctnhome')
		}).send();	
	}
	function viewflv(flvfile,desc) {
		var req = new Request.HTML({
			method: 'get',
			url: 'dsp_flv.php',
			data : {'flvfile':flvfile,'desc':desc},
			onRequest : showLoading('imgctn'),
			update: $('imgctn')
		}).send();	
	}
	function viewimg(file,desc) {
		var req = new Request.HTML({
			method: 'get',
			url: 'dsp_img.php',
			data : {'file':file,'desc':desc},
			onRequest : showLoading('imgctn'),
			update: $('imgctn')
		}).send();	
	}
	function cekemail(ltype,lform) {
		if (ltype == 'focus') {
			if (lform == 'email') {
				if (document.login.user.value == "Email") {document.login.user.value = "";}				
			}
			if (lform == 'password') {
				if (document.login.password.value == "Password") {document.login.password.type = "password";document.login.password.value = "";}				
			}
		}
		if (ltype == 'blur') {
			if (lform == 'email') {
				if (document.login.user.value == "") {document.login.user.value = "Email";}				
			}
			if (lform == 'password') {
				if (document.login.password.value == "") {document.login.password.type = "text";document.login.password.value = "Password";}				
			}
		}
		
	}
	
	hs.graphicsDir = 'includes/highslide/graphics/';
	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.outlineType = 'glossy-dark';
	hs.wrapperClassName = 'dark';
	hs.fadeInOut = true;
	//hs.dimmingOpacity = 0.75;
	
	// Add the controlbar
	if (hs.addSlideshow) hs.addSlideshow({
		//slideshowGroup: 'group1',
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: 'fit',
		overlayOptions: {
			opacity: .6,
			position: 'bottom center',
			hideOnMouseOut: true
		}
	});
