// View content
<!--
var langconnect="";
var LAST_DIV="none";
var LAST_LINK="none";
var welcomenotemenu="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"14%\"><img src=\"images/submain/sub_star_gray.gif\" width=\"31\" height=\"26\" /></td><td width=\"86%\" class=\"button\"><a onmouseover=\"this.style.color='#ff0033';\" onmouseout=\"this.style.color='#000000';\" style=\"color:#000000; font-size:13px;  text-decoration:none\" href=\"#\" onClick=\"loadmenu('welcomemenuleft_test.php','KataKataAluan','1');return false;\">Kata-Kata Aluan</a></td></tr></table>";

var membership="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"14%\"><img src=\"images/submain/sub_star_gray.gif\" width=\"31\" height=\"26\" /></td><td width=\"86%\" class=\"button\"><a onmouseover=\"this.style.color='#ff0033';\" onmouseout=\"this.style.color='#000000';\" style=\"color:#000000; font-size:13px;  text-decoration:none\" href=\"#\" onClick=\"loadmenu('membershipleftmenu.php','membership','2');return false;\">Membership</a></td></tr></table>";

//var programm="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"14%\"><img src=\"images/submain/sub_star_gray.gif\" width=\"31\" height=\"26\" /></td><td width=\"86%\" class=\"button\"><a onmouseover=\"this.style.color='#ff0033';\" onmouseout=\"this.style.color='#000000';\" style=\"color:#000000; font-size:13px;  text-decoration:none\" href=\"#\" onClick=\"loadmenu('programmenuleft.php','Program','3');return false;\">RakanMuda Program</a></td></tr></table>";

//var programmbaru="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"14%\"><img src=\"images/submain/sub_star_gray.gif\" width=\"31\" height=\"26\" /></td><td width=\"86%\" class=\"button\"><a onmouseover=\"this.style.color='#ff0033';\" onmouseout=\"this.style.color='#000000';\" style=\"color:#000000; font-size:13px;  text-decoration:none\" href=\"#\" onClick=\"loadmenu('program_baru_menuleft.php','ProgramBaru','3');return false;\">New Programmes</a></td></tr></table>";

var gayahidup="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"14%\"><img src=\"images/submain/sub_star.png\" width=\"31\" height=\"26\" /></td><td width=\"86%\" class=\"button\"><a onmouseover=\"this.style.color='#ff0033';\" onmouseout=\"this.style.color='#000000';\" style=\"color:#000000; font-size:13px;  text-decoration:none\" href=\"#\" onClick=\"loadmenu('gaya_hidup_menuleft.php','GayaHidup','6');return false;\">7 Gaya Hidup</a></td></tr></table>";

var programmbaru="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"14%\"><img src=\"images/submain/sub_star.png\" width=\"31\" height=\"26\" /></td><td width=\"86%\" class=\"button\"><a onmouseover=\"this.style.color='#ff0033';\" onmouseout=\"this.style.color='#000000';\" style=\"color:#000000; font-size:13px;  text-decoration:none\" href=\"#\" onClick=\"loadmenu('program_baru_menuleft.php','ProgramBaru','3');return false;\">Program Baru</a></td></tr></table>";

var activities="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"14%\"><img src=\"images/submain/sub_star_gray.gif\" width=\"31\" height=\"26\" /></td><td width=\"86%\" class=\"button\"><a onmouseover=\"this.style.color='#ff0033';\" onmouseout=\"this.style.color='#000000';\" style=\"color:#000000; font-size:13px;  text-decoration:none\" href=\"#\" onClick=\"loadmenu('Activitiesmenuleft.php','Activities','4');return false;\">Activities</a></td></tr></table>";

var Merchant="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"14%\"><img src=\"images/submain/sub_star_gray.gif\" width=\"31\" height=\"26\" /></td><td width=\"86%\" class=\"button\"><a onmouseover=\"this.style.color='#ff0033';\" onmouseout=\"this.style.color='#000000';\" style=\"color:#000000; font-size:13px;  text-decoration:none\" href=\"#\" onClick=\"loadmenu('Merchantmenuleft.php','Merchant','5');return false;\">Merchant Partners</a></td></tr></table>";

var xmlhttp=false;

try
{
	xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");	
} catch(e)
	{
		try{				
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}catch(E)
	{
		xmlhttp=false;
	}	
}

if(!xmlhttp && typeof XMLHttpRequest !='undefined'){
	xmlhttp=new XMLHttpRequest();		
}

var xmlhttp2=false;

try
{
	xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP");	
} catch(e)
	{
		try{				
			xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");		
	}catch(E)
	{
		xmlhttp2=false;
	}	
}

if(!xmlhttp2 && typeof XMLHttpRequest !='undefined'){
	xmlhttp2=new XMLHttpRequest();		
}

function trimAll(sString) 
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

//modified on 19-2-2007
function hidecontent(obj2hide)
{
	document.getElementById(obj2hide).innerHTML="";	
}

function switchlang()
{
	window.location.href="http://www.2-u.com.my/en/home.php?saveurl=y&"+langconnect;
}

function loadcontent(url,loadto,waitsize,title,addressbar,needconformation,Msg)
{
	//alert("dd");
	langconnect=url.substring(url.indexOf("?")+1);
	var trv=document.getElementById(loadto);
	//var trv2=document.getElementById("loading");
	trv.innerHTML='<img src="images/mainpage/loading.gif" alt="loading" />';

	serverPage=url;	
	
	xmlhttp.open("POST",serverPage,true);	
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			//trv2.innerHTML="";			
			trv.innerHTML=xmlhttp.responseText;
		}	
	}
	xmlhttp.send(null);	
}

function loadcontentnostatus(url,loadto)
{
	//alert("dd");
	langconnect=url.substring(url.indexOf("?")+1);
	var trv=document.getElementById(loadto);
	//var trv2=document.getElementById("loading");
	//trv.innerHTML='<img src="images/mainpage/loading.gif" alt="loading" />';

	serverPage=url;	
	
	xmlhttp.open("POST",serverPage,true);	
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			//trv2.innerHTML="";			
			trv.innerHTML=xmlhttp.responseText;
		}	
	}
	xmlhttp.send(null);	
}

function loadcontent2(url,loadto,waitsize,title,addressbar,needconformation,Msg)
{
	//alert("dd");
	var trv2=document.getElementById(loadto);
	//var trv2=document.getElementById("loading");
	trv2.innerHTML='<img src="images/mainpage/loading.gif" alt="loading" />';

	serverPage=url;	
	
	xmlhttp2.open("POST",serverPage,true);	
	xmlhttp2.onreadystatechange=function(){
		if(xmlhttp2.readyState==4 && xmlhttp2.status==200){
			//trv2.innerHTML="";			
			trv2.innerHTML=xmlhttp2.responseText;
		}	
	}
	xmlhttp2.send(null);	
}

function load2content(contenturl1,contentdiv1,contenturl2,contentdiv2)
{	
	loadcontent(contenturl1,contentdiv1);
	loadcontent2(contenturl2,contentdiv2);
}

function loadmenu(url,loadto,menu_id)
{
	//alert(LAST_DIV);
	var trv=document.getElementById(loadto);
	//var trv2=document.getElementById("loading");
	
	//trv2.innerHTML='<img src="images/loading.gif" alt="loading" />';
	if(document.getElementById(LAST_DIV)){
		var trv3=document.getElementById(LAST_DIV);
		switch(LAST_LINK){
			case "1":
				//alert(menu_id);
				trv3.innerHTML=welcomenotemenu;
				break
			case "2":
				//alert(menu_id);
				trv3.innerHTML=membership;
				break
			case "3":
				//alert(menu_id);
				trv3.innerHTML=programmbaru;
				break
			case "4":
				//alert(menu_id);
				trv3.innerHTML=activities;
				break
			case "5":
				//alert(menu_id);
				trv3.innerHTML=Merchant;
				break
			case "6":
				//alert(menu_id);
				trv3.innerHTML=gayahidup;
				break					
			case "8":
				//alert(menu_id);
				trv3.innerHTML=classified_menu;
				break
			case "9":
				//alert(menu_id);
				trv3.innerHTML=shop_menu;
				break
			default:
				//alert("ddd");
		}
	}
	
	LAST_DIV=loadto;
	LAST_LINK=menu_id;
	serverPage=url;	
	xmlhttp.open("POST",serverPage,true);	
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			//trv2.innerHTML="";
			trv.innerHTML=xmlhttp.responseText;
		}	
	}
	xmlhttp.send(null);	
}

function loadmenu2(url,loadto,menu_id,contenturl,contentdiv)
{
	//alert(LAST_DIV);
	var trv=document.getElementById(loadto);
	//var trv2=document.getElementById("loading");
	
	//trv2.innerHTML='<img src="images/loading.gif" alt="loading" />';
	if(document.getElementById(LAST_DIV)){
		var trv3=document.getElementById(LAST_DIV);
		switch(LAST_LINK){
			case "2":
				//alert(menu_id);
				trv3.innerHTML=entertainment_menu;
				break
			case "3":
				//alert(menu_id);
				trv3.innerHTML=travels_menu;
				break
			case "4":
				//alert(menu_id);
				trv3.innerHTML=lifestyles_menu;
				break
			case "7":
				//alert(menu_id);
				trv3.innerHTML=gallery_menu;
				break
			case "8":
				//alert(menu_id);
				trv3.innerHTML=classified_menu;
				break
			case "9":
				//alert(menu_id);
				trv3.innerHTML=shop_menu;
				break	
			default:
				//alert("ddd");
		}
	}
	
	LAST_DIV=loadto;
	LAST_LINK=menu_id;
	serverPage=url;	
	xmlhttp.open("POST",serverPage,true);	
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			trv.innerHTML=xmlhttp.responseText;
			loadcontent(contenturl,contentdiv);
		}	
	}
	xmlhttp.send(null);	
	
}

function loadcontentWithPrompt(url,loadto,Msg)
{
	if (Msg!='No'){ 
		var confirmMsg  = 'Do you want to ';
		var is_confirmed = confirm(confirmMsg + ' :\n' + Msg);
		if(is_confirmed==false){
			return false;
		}
	}
	
	var trv=document.getElementById(loadto)
	trv.innerHTML='Loading...';
	serverPage=url;	
	xmlhttp.open("POST",serverPage,true);	
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			trv.innerHTML="";
			trv.innerHTML=xmlhttp.responseText;
		}	
	}
	xmlhttp.send(null);	
}


function guest_registration2(thisform) {
	var nscreen=trimAll(document.getElementById("guest_screen").value);
	if(document.getElementById("guest_screen").value.length==""){
			alert('Please type your screen name');
			document.getElementById("guest_screen").focus();
	return false;}	
	
	var spacepost=nscreen.indexOf(" ");
	if(spacepost>0){
			alert('Space is not allowed for screen name');
			document.getElementById("guest_screen").focus();
	return false;}
	
	var uname=trimAll(document.getElementById("guest_user").value);
	if(document.getElementById("guest_user").value.length==""){
			alert('Please type your username');
			document.getElementById("guest_user").focus();
	return false;}	
	
	var spacepost=uname.indexOf(" ");
	if(spacepost>0){
			alert('Space is not allowed for username');
			document.getElementById("guest_user").focus();
	return false;}
	
	if(document.getElementById("guest_pass").value.length==""){
			alert('Please typeyour password');
			document.getElementById("guest_pass").focus();
	return false;}
	
	if(document.getElementById("guest_pass").value.length<6){
			alert('Your password is too short');
			document.getElementById("guest_pass").focus();
	return false;}
	
	var pwd=trimAll(document.getElementById("guest_pass").value);
	var spacepost=pwd.indexOf(" ");
	if(spacepost>0){
			alert('Space is not allowed for password');
			document.getElementById("guest_pass").focus();
	return false;}
	
	if(document.getElementById("guest_firm").value.length==""){
			alert('Please comfirm your password');
			document.getElementById("guest_firm").focus();
	return false;}
	
	if(document.getElementById("guest_firm").value!=document.getElementById("guest_pass").value){
			alert('Retyped password does not match.');
			document.getElementById("guest_firm").focus();
	return false;}
}
function guest_registration(thisform) {
	var uname=trimAll(document.getElementById("guest_user").value);
	//alert(uname);
	
	//alert(spacepost);
	
	
	if(document.getElementById("guest_user").value.length==""){
			alert('Please type your username');
			document.getElementById("guest_user").focus();
	return false;}	
	
	var spacepost=uname.indexOf(" ");
	
	if(spacepost>0){
			alert('Space is not allowed for username');
			document.getElementById("guest_user").focus();
	return false;}
	
	if(document.getElementById("guest_pass").value.length==""){
			alert('Please typeyour password');
			document.getElementById("guest_pass").focus();
	return false;}
	
	if(document.getElementById("guest_pass").value.length<6){
			alert('Your password is too short');
			document.getElementById("guest_pass").focus();
	return false;}
	
	var pwd=trimAll(document.getElementById("guest_pass").value);
		
	var spacepost=pwd.indexOf(" ");
	//alert(spacepost);
	if(spacepost>0){
			alert('Space is not allowed for password');
			document.getElementById("guest_pass").focus();
	return false;}
	
	if(document.getElementById("guest_firm").value.length==""){
			alert('Please comfirm your password');
			document.getElementById("guest_firm").focus();
	return false;}
	
	if(document.getElementById("guest_firm").value!=document.getElementById("guest_pass").value){
			alert('Retyped password does not match.');
			document.getElementById("guest_firm").focus();
	return false;}
	
	if(document.getElementById("guest_fullname").value.length==""){
			alert('Please typeyour fullname');
			document.getElementById("guest_fullname").focus();
	return false;}
	
	if(document.getElementById("guest_ic1").value.length==""){
			alert('Please type your New IC Number');
			document.getElementById("guest_ic1").focus();
	return false;}

	if(document.getElementById("guest_ic22").value.length==""){
			alert('Please type your New IC Number');
			document.getElementById("guest_ic22").focus();
	return false;}

	if(document.getElementById("guest_ic3").value.length==""){
			alert('Please type your New IC Number');
			document.getElementById("guest_ic3").focus();
	return false;}

	if(document.getElementById("race").value.length==""){
			alert('Please select your Race');
			document.getElementById("race").focus();
	return false;}
	
	if(document.getElementById("guest_email").value.length==""){
			alert('Please type your email');
			document.getElementById("guest_email").focus();
		return false;}
	
	if(document.getElementById("guest_email").value != ''){
		if(!Is_Email_Valid(document.getElementById("guest_email"))){
			document.getElementById("guest_email").focus();
			return false;
		}
	}
	
	if(document.getElementById("guest_mobile").value.length==""){
			alert('Please type your mobile phone number');
			document.getElementById("guest_mobile").focus();
		return false;}
	
	if(document.getElementById("guest_homephone").value.length==""){
			alert('Please type your home phone number');
			document.getElementById("guest_homephone").focus();
	return false;}
	var sms="";
	
	for (i=0;i<document.getElementById("frmregist").sms.length;i++){
		if (document.getElementById("frmregist").sms[i].checked==true){
			sms=document.getElementById("frmregist").sms[i].value;
		}		
	}
	
	
	if(sms==""){
			alert('Please check your SMS');
	return false;}
	
	var gen="";
	for (i=0;i<document.getElementById("frmregist").gender.length;i++){
		if (document.getElementById("frmregist").gender[i].checked==true){
			gen=document.getElementById("frmregist").gender[i].value;
		}		
	}
	
		
	if(gen==""){
			alert('Please check your gender');
	return false;}
	
	
	if(document.getElementById("b_date").value=="00"){
			alert('Please complete your birthday');
			document.getElementById("b_date").focus();
	return false;}
	
	if(document.getElementById("b_month").value=="00"){
			alert('Please complete your birthday');
			document.getElementById("b_month").focus();
	return false;}
	
	if(document.getElementById("b_year").value=="0000"){
			alert('Please complete your birthday');
			document.getElementById("b_year").focus();
	return false;}
	
	
	var proop="";
	for (i=0;i<document.getElementById("frmregist").proopt.length;i++){
		if (document.getElementById("frmregist").proopt[i].checked==true){
			proop=document.getElementById("frmregist").proopt[i].value;
		}		
	}
	
		
	if(proop==""){
			alert('Please check your profession');
	return false;}
		
	
	if(document.getElementById("guest_address1").value.length==""){
			alert('Please type your address');
			document.getElementById("guest_address1").focus();
	return false;}	
	
	if(document.getElementById("ship_state").value=="*"){
			alert('Please select state and country');
			document.getElementById("ship_state").focus();
	return false;}	
	
	if(document.getElementById("ship_zip").value.length==""){
			alert('Please type Zip code');
			document.getElementById("ship_zip").focus();
	return false;}	
	
	if(document.getElementById("guest_programm").checked!=true){
			alert('Please check terms and conditions of RAKAN MUDA card holder.');
			//document.getElementById("agree").focus();
	return false;}
	
	if(document.getElementById("guest_termbox").checked!=true){
			alert('Please agree to terms and conditions');
			//document.getElementById("agree").focus();
	return false;}
	return true;
}

function Is_Email_Valid(emailobj){	
	if(emailobj.value != ''){		
		if (emailobj.value.indexOf('@')==-1)	 	 
			{alert("You missed @ in your eMail Address.");
			emailobj.focus();
			 return false; }
		if (emailobj.value.indexOf('.')==-1)
			{alert("You missed . in your eMail Address");
			emailobj.focus();
			return false;}	
		if (emailobj.value.indexOf('@.')!=-1)	 	 
			{alert("Email Address contains an Unrecognised '@.' Character");
			emailobj.focus();
			 return false;}
		return true;
	}
}

function displayMsg(showin,msg,focusobj)
{
	document.getElementById(focusobj).focus;
	document.getElementById(showin).innerHTML=msg;	
}
function displayResult(showin,msg)
{
	document.getElementById(showin).innerHTML=msg;	
}

function ChkEmail(Reg_form){
	//if(Reg_form.oldemail.value.length==""){
	//		alert('Sila taip emel lama anda');
	//		Reg_form.oldemail.focus();
	//return false;}
	if(Reg_form.oldemail.value!=Reg_form.hiddenemail.value){
			alert('Old email is wrong');
			Reg_form.oldemail.focus();
	return false;}
	if(Reg_form.newemail.value.length==""){
			alert('Please type your new email');
			Reg_form.newemail.focus();
	return false;}
	if(Reg_form.confirmemail.value.length==""){
			alert('Please retype new email');
			Reg_form.confirmemail.focus();
	return false;}
	if(Reg_form.confirmemail.value!=Reg_form.newemail.value){
			alert('Retyped email does not match');
			Reg_form.confirmemail.focus();
	return false;}
	
	if(Reg_form.oldemail.value != ''){
		if(!Is_Email_Valid(Reg_form.oldemail)){
			return false;
		}
	}

	if(Reg_form.newemail.value != ''){
		if(!Is_Email_Valid(Reg_form.newemail)){
			return false;
		}
	}
		
	if(Reg_form.confirmemail.value != ''){
		if(!Is_Email_Valid(Reg_form.confirmemail)){
			return false;
		}
	}
return true;	
}

function Chkpassword(Reg_form){
	if(Reg_form.oldpassword.value.length==""){
			alert('Please type your old password');
			Reg_form.oldpassword.focus();
	return false;}
	if(Reg_form.oldpassword.value!=Reg_form.hiddenpassword.value){
			alert('Old password is wrong');
			Reg_form.oldpassword.focus();
	return false;}
	if(Reg_form.newpassword.value.length==""){
			alert('Please type new password');
			Reg_form.newpassword.focus();
	return false;}
	if(Reg_form.confirmpassword.value.length==""){
			alert('Please retype new password');
			Reg_form.confirmpassword.focus();
	return false;}
	if(Reg_form.confirmpassword.value!=Reg_form.newpassword.value){
			alert('Retyped password does not match');
			Reg_form.confirmpassword.focus();
	return false;}
	return true;
	//Reg_form.submit();
}

function uploadprofileimg(theform) {
	if(theform.profile_file.value==""){
		alert("Please browse your photo file.");
		theform.profile_file.focus;
		return false;
	}
	//var displayprocess='Uploading...please wait';
	//document.getElementById("uploadstatus").innerHTML=displayprocess;
	theform.submit();	
}
function uploadprofileimgbig(theform) {
	if(theform.profile_file_big.value==""){
		alert("Please browse your photo file.");
		theform.profile_file_big.focus;
		return false;
	}
	//var displayprocess='Uploading...please wait';
	//document.getElementById("uploadstatus").innerHTML=displayprocess;
	theform.submit();	
}

function displayUploadResult(objtarget,msg) {
	document.getElementById(objtarget).innerHTML=msg;
}

function CheckProduct(theform) {
	if(theform.catid.value=="0"){
		alert("Please select category name.");
		theform.catid.focus;
		return false;
	}	
	if(theform.productname.value=="0"){
		alert("Please type product name.");
		theform.productname.focus;
		return false;
	}	
}

function checklogin(theform) {
	if(document.getElementById("guest_username").value.length=="0"){
		alert("Please type your username.");
		document.getElementById("guest_username").focus();
		return false;
	}	
	if(document.getElementById("guest_password").value.length=="0"){
		alert("Please type your password.");
		document.getElementById("guest_password").focus();
		return false;
	}	
}

function gotpass(frm) {
	if(document.getElementById("rqmail").value.length==""){
		alert('Please type email');
		document.getElementById("rqmail").focus();
		return false;
	}
	if(document.getElementById("rqmail").value != ''){
		if(!Is_Email_Valid(document.getElementById("rqmail"))){
			return false;
		}
	}		
	//var gotmail = "rqmail=" + encodeURI( document.getElementById("rqmail").value );
	//makePOST('forgotpassword_end.php','mainarea',gotmail);
}
function loginsuccess() {
	window.location = "index.php";
}
function uploadvdogallery(theform) {

	if(theform.memberlogin.value==""){
		alert("Sila log masuk untuk menggunakan perkhidmatan");
		return false;
	}
	else if(theform.videofile.value==""){
		alert("Please browse your video file.");
		theform.videofile.focus;
		return false;
	}
	else if(theform.video_title.value==""){
		alert("Please type your video title.");
		theform.video_title.focus;
		return false;
	}
	else if(document.getElementById("checkterm").checked!=true){
		alert("Please agree to Terms and Conditions");
		document.getElementById("checkterm").focus;
		return false;
	}
	var displayprocess='<table bgcolor="#666666" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="39%" style="padding-left:10px; height:20px; color:#ffffff" align="right">Uploading . . .</td><td width="61%" valign="middle"><img src="images/mainpage/splash_line.gif" alt="loading" /></td></tr></table>';
	document.getElementById("uploadstatus").innerHTML=displayprocess;
	return true; 
	//theform.submit();	
}

function uploadphotogallery(theform) {
	if(theform.photofile.value==""){
		alert("Please browse your photo file.");
		theform.photofile.focus;
		return false;
	}
	if(document.getElementById("checkterm").checked!=true){
		alert("Please agree to Terms and Conditions");
		document.getElementById("checkterm").focus;
		return false;
	}
	var displayprocess='<table bgcolor="#666666" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="39%" style="padding-left:10px; height:20px; color:#ffffff" align="right">Uploading . . .</td><td width="61%" valign="middle"><img src="images/mainpage/splash_line.gif" alt="loading" /></td></tr></table>';
	document.getElementById("uploadstatus").innerHTML=displayprocess;
	//theform.submit();	
}

function retateGalleyPhoto(divid,action,photoid) { 
	var ok=true;
	
	if (ok==true) {
	
		var obj=document.getElementById(divid)
		obj.innerHTML='<img src="images/mainpage/loading.gif" alt="loading" />';			   
		serverPara="?divid="+divid+"&action="+action+"&photoid="+photoid;	
		serverPage="rotategalleryphoto.php"+serverPara;	
		//alert(serverPage);
		xmlhttp.open("POST",serverPage);	
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4 && xmlhttp.status==200){
				obj.innerHTML=xmlhttp.responseText;
			}	
		}
		xmlhttp.send(null);
	}
}

function ChkBannerOwner(Reg_form){
	if(Reg_form.ownername.value.length==""){
			alert('Please type banner owner');
			Reg_form.ownername.focus();
	return false;}
	if(Reg_form.uname.value.length==""){
			alert('Please type username');
			Reg_form.uname.focus();
	return false;}
	if(Reg_form.pwd.value.length==""){
			alert('Please type password');
			Reg_form.pwd.focus();
	return false;}
	if(Reg_form.cpwd.value.length==""){
			alert('Please retype password');
			Reg_form.cpwd.focus();
	return false;}
	if(Reg_form.cpwd.value!=Reg_form.pwd.value){
			alert('Retyped password does not match');
			Reg_form.cpwd.focus();
	return false;}
}

function ChkBannerform(Reg_form){
	if(Reg_form.bannername.value.length==""){
			alert('Please type banner name ');
			Reg_form.bannername.focus();
	return false;}
	if(Reg_form.cat_id.value=="none"){
			alert('Please select category');
			Reg_form.cat_id.focus();
	return false;}
	if(Reg_form.owner_id.value=="none"){
			alert('Please select owner');
			Reg_form.owner_id.focus();
	return false;}
	//if(Reg_form.bannerurl.value.length==""){
	//		alert('Please type banner URL');
	//		Reg_form.bannerurl.focus();
	//return false;}
	if(Reg_form.bannerowner.value.length==""){
			alert('Please type banner owner');
			Reg_form.bannerowner.focus();
	return false;}
	if(Reg_form.date_from.value.length==""){
			alert('Please pick date available : from');
			Reg_form.date_from.focus();
	return false;}
	if(Reg_form.date_to.value.length==""){
			alert('Please pick date available : to');
			Reg_form.date_to.focus();
	return false;}
}

function changephototext(frm) {
	if(document.getElementById("photo_title").value.length==""){
			alert('Please type photo title');
			document.getElementById("photo_title").focus();
	return false;}
}


function sharephoto() {
	if(document.getElementById("friendemail").value.length==""){
		alert('Please type friend email');
		document.getElementById("friendemail").focus();
		return false;
	}
	var emailstr=document.getElementById("friendemail").value;
	var partnum=0;
	var newstr="";
	while(partnum<emailstr.length){
		partstr=emailstr.substr(partnum,1);
		if(partstr!=" "){
			newstr=newstr+partstr;
		}
		partnum+=1;
	}
	partnum=0;
	var emailarray=newstr.split(",");
	while(partnum<emailarray.length){
		emailstr=emailarray[partnum];
		if(!IsEmail(emailstr,emailstr=document.getElementById("friendemail"))){
			return false;			
		}		
		partnum+=1;
	}
	//var sharemail = "friendemail=" + encodeURI(newstr)+"&message=" + encodeURI( document.getElementById("message").value )+"&myname=" + encodeURI( document.getElementById("myname").value );
	//makePOST('sharephoto_end.php','photogalleryact',sharemail);
}

function sharevdo() {
	if(document.getElementById("friendemail").value.length==""){
		alert('Please type friend email');
		document.getElementById("friendemail").focus();
		return false;
	}
	var emailstr=document.getElementById("friendemail").value;
	var partnum=0;
	var newstr="";
	while(partnum<emailstr.length){
		partstr=emailstr.substr(partnum,1);
		if(partstr!=" "){
			newstr=newstr+partstr;
		}
		partnum+=1;
	}
	partnum=0;
	var emailarray=newstr.split(",");
	while(partnum<emailarray.length){
		emailstr=emailarray[partnum];
		if(!IsEmail(emailstr,emailstr=document.getElementById("friendemail"))){
			return false;			
		}		
		partnum+=1;
	}
	//var sharemail = "friendemail=" + encodeURI(newstr)+"&message=" + encodeURI( document.getElementById("message").value )+"&myname=" + encodeURI( document.getElementById("myname").value );
	//makePOST('sharevdo_end.php','photogalleryact',sharemail);
}


function ratevdonow(theform)
{
	//var vfrm = document.getElementById("ratefrm");
	//document.getElementById("babepasswd").value.length==""
	var selection = theform.myvote;
	var voteval=0;
	for (i=0; i<selection.length; i++){
		if (selection[i].checked == true){
			voteval=selection[i].value;
		}
	}
	if(theform.whovote.value.length==""){
		alert('Please login to rate this vdo');
		return false;
	}
	if(voteval==0){
		alert('Please select rating number');
		return false;
	} 
	theform.submit();
}	

function ChkContactform(theform)
{
	
	if(theform.yourname.value.length==""){
		alert('(Please type your name');
		theform.yourname.focus();
		return false;
	}
	
	if(theform.yourphone.value.length==""){
		alert('Please type your phone number');
		theform.yourphone.focus();
		return false;
	}
	if(theform.youremail.value.length==""){
		alert('Please type your email');
		theform.youremail.focus();
		return false;
	}
	if(theform.youremail.value != ''){
		if(!Is_Email_Valid(theform.youremail)){
			return false;
		}
	}
	
	if(theform.yourmessage.value.length==""){
		alert('Please type your message');
		theform.yourmessage.focus();
		return false;
	}
}

//
function loadtopage(pagefile,toarea){
	if(document.getElementById("topage").value!=""){
		var pagenum=(document.getElementById("topage").value-1)*30;
		var papam='?listoffset='+pagenum;	
		loadcontentnostatus(pagefile+papam,toarea);	
	}	
}
function loadsearchforgallery(pagefile,toarea){
	if(document.getElementById("searchfor").value!=""){
		var searchfor=document.getElementById("searchfor").value;
		var papam='?searchfor='+searchfor;	
		loadcontentnostatus(pagefile+papam,toarea);	
	}	
}
function Check(chk)
{
	if(document.myform.Check_ctr.checked==true){
		for (i = 0; i < chk.length; i++)
		chk[i].checked = true ;
	}else{
		for (i = 0; i < chk.length; i++)
		chk[i].checked = false ;
	}
}
function CheckAll(chk)
{
	for (i = 0; i < chk.length; i++){
		chk[i].checked = true ;
	}
}
function UnCheckAll(chk)
{
	for (i = 0; i < chk.length; i++){
		chk[i].checked = false ;
	}
}
function filteralbum(){
	var abid=document.getElementById("to_album").value;
	loadcontentnostatus('myspace.php?album_id='+abid,'photogalleryact');
}
function clearefield(){
	var abid=document.getElementById("friendemail").value;
	if(abid=="E-mel dengan komma (, )"){
		document.getElementById("friendemail").value="";	
	}
}
function CheckString(key){
	if(key == 222){
		alert("This character is not allowed!");
		return false;
	}
}

function Checksalarawan(theform)
{
	
	if(theform.guest_name.value.length==""){
		alert('(Please type NAMA PERTUBUHAN');
		theform.guest_name.focus();
		return false;
	}
	
	if(theform.guest_JAWATAN.value.length==""){
		alert('Please type JAWATAN ');
		theform.guest_JAWATAN.focus();
		return false;
	}	
}


function  Ekau(theform)
{
form_webForm=document.saveekau
submitOK="True"

if(form_webForm.title.value == "" && submitOK == "True"){
alert("Please type your title")
	submitOK="False"
}

if (submitOK=="False")
{
return false
}
}

function searchresfromindex(){
	var kw=document.getElementById("searchkeyword").value;
	//alert(kw);	
	if(kw==""){
		alert("Please type keyword");	
		document.getElementById("searchkeyword").focus();
	}else{
		window.location.href="home.php?do=search&keyword="+kw;
		//loadcontentnostatus('home.php?do=search&keyword='+kw,'mainarea');
	}
}

function searchres(){
	var kw=document.getElementById("searchkeyword").value;
	if(kw==""){
		alert("Please type keyword");	
		document.getElementById("searchkeyword").focus();
	}else{
		loadcontentnostatus('main_search.php?keyword='+kw,'mainarea');
	}
}
function searchres2(){
	var kw2=document.getElementById("searchkeyword2").value;
	if(kw2==""){
		alert("Please type keyword");	
		document.getElementById("searchkeyword2").focus();
	}else{
		loadcontentnostatus('main_search.php?keyword='+kw2,'mainarea');
	}
}

function letternumber(e){

var key;
var keychar;

if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();

// control keys
if ((key==null) || (key==0) || (key==8) || 
(key==9) || (key==13) || (key==27) )
return true;

// alphas and numbers    else if (((" 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").indexOf(keychar) > -1))
else if (((" 0123456789-").indexOf(keychar) > -1))
return true;
else
return false;
}
function Change_catid(frm){
	var i;
	var selectedid;
	for(i=0;i<frm.cat_id.length;i++){
		if(frm.cat_id[i].selected && frm.cat_id[i].value!=''){
			selectedid='gifts.php?cat_id=' + frm.cat_id[i].value;
			//alert(selectedid);
			loadcontentnostatus(selectedid,'photoarea');
		}
	}
}
function Change_qty(frm){
	
	frm.myaction.value="1";
	frm.submit();
		
}
function Change_cat_product(frm){
	var i;
	var selectedid;
	for(i=0;i<frm.product_cat_name.length;i++){
		if(frm.product_cat_name[i].selected && frm.product_cat_name[i].value!=''){
			selectedid='cannon_point_product.php?cat_pid=' + frm.product_cat_name[i].value;
			//alert(selectedid);
			loadcontentnostatus(selectedid,'product');
		}
	}
}
function Checkzipcode(frm){
	
	var file;	
	var zipcode = document.getElementById( 'ship_zip' ).value;
	//var picResult = document.getElementById( 'picResult' );
	//picResult.innerHTML = zipcode;
	
	file='checkzipcode.php?zipcode=' + zipcode;
	loadcontentnostatus(file,'zipcode');

}
//-->