// JavaScript Document

window.defaultStatus="Welcome to Tekno Media Online";
testEmail="info@teknomediaonline.com";

//stopping Enter key
function stopRKey(evt) { 
  var evt = (evt) ? evt : ((event) ? event : null); 
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); 
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;} 
} 

document.onkeypress = stopRKey; 

//stopping rightclick
/*
var mouseDn=false;

document.onmousedown=right;
document.onmouseup=mouseUp;
document.onmousemove=move;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
if (document.layers) window.captureEvents(Event.MOUSEMOVE);
window.onmousedown=right;
window.onmouseup=mouseUp;
window.onmousemove=move;

function mouseUp(e){
	mouseDn=false;
}
function move(e){
	if (mouseDn == true){
		window.alert("Sorry! Drag is Blocked!");
		mouseDn=false;
	}
}
function right(e) {
	//if (navigator.appName == 'Microsoft Internet Explorer'){
	//	window.alert(event.button);
	//}
	if (navigator.appName == 'Netscape'){
		if (e.which == 3 || e.which == 2){
			window.alert("Sorry! Right Click is Blocked!");
			return false;
		}
		if (e.which == 1){
			mouseDn=true;
		}
	}else if (navigator.appName == 'Microsoft Internet Explorer'){
		if (event.button == 2 || event.button == 3) {
			window.alert("Sorry! Right Click is Blocked!");
			return false;
		}
		if (event.button == 1){
			mouseDn=true;
		}
	}
	return true;
} 
*/

// stopping right click - end

function setup(){
	var uid;
	uid=document.myForm1.userid.value;
	//hideInquiryForm();
	if (uid == ""){
		if (document.getElementById('welcomeMsg')){
			document.getElementById('welcomeMsg').style.display="none";
			welcomeMsg.style.visibility="hidden";
		}else{
			document.getElementById('welcomeMsg').style.display="";
			welcomeMsg.style.visibility="hidden";
		}
		if (document.getElementById('signOnPanel')){
			document.getElementById('signOnPanel').style.display="";
			signOnPanel.style.visibility="visible";
		}else{
			document.getElementById('signOnPanel').style.display="none";
			signOnPanel.style.visibility="hidden";
		}
		document.getElementById('memberMenu').style.display="none";
		//document.getElementById('onlineMenu').style.display="none";
	}else{
		if (document.getElementById('welcomeMsg')){
			document.getElementById('welcomeMsg').style.display="";
			document.getElementById('welcomeFname').innerHTML=uid;
			welcomeMsg.style.visibility="visible";
		}else{
			document.getElementById('welcomeMsg').style.display="none";
			welcomeMsg.style.visibility="hidden";
		}
		if (document.getElementById('signOnPanel')){
			document.getElementById('signOnPanel').style.display="none";
			signOnPanel.style.visibility="hidden";
		}else{
			document.getElementById('signOnPanel').style.display="";
			signOnPanel.style.visibility="hidden";
		}
	}
	document.getElementById('forgot').style.display="none";
	//hideInquiryForm();
}
function setup_chngprof(){
	var city, i;
	setup();
	city=document.myForm1.city.value;
	for (i=0; i<document.myForm1.lstCity.length; i++){
		if (document.myForm1.lstCity.options[i].text == city){
			document.myForm1.lstCity.selectedIndex=i;
			break;
		}
	}
}
function setup_videores(){
	setup();
	document.getElementById('txtOther').style.display="none";
}
function song_setup(){
	setup();
	songPageSetup();
}
function setup_photodesign(){
	var userId;
	setup();
	userId=document.myForm1.userid.value;
	if (userId == ""){
		//access denied to use the form
		//document.myForm1.txtName.disabled=true;
		//document.myForm1.txtAddress.disabled=true;
		//document.myForm1.txtEmail.disabled=true;
		//document.myForm1.txtPhone.disabled=true;
		//document.myForm1.fileImg.disabled=true;
		//document.myForm1.lstAttch.disabled=true;
		//document.myForm1.btnAddPic.disabled=true;
		//document.myForm1.btnRemovePic.disabled=true;
		//document.myForm1.txtMsg.disabled=true;
		//document.myForm1.btnSend.disabled=true;
		//document.myForm1.btnClear.disabled=true;
	}else{
		//accedss granted to use the form
		//document.myForm1.txtName.disabled=false;
		//document.myForm1.txtAddress.disabled=false;
		//document.myForm1.txtEmail.disabled=false;
		//document.myForm1.txtPhone.disabled=false;
		//document.myForm1.fileImg.disabled=false;
		//document.myForm1.lstAttch.disabled=false;
		//document.myForm1.btnAddPic.disabled=true;
		//document.myForm1.btnRemovePic.disabled=true;
		//document.myForm1.txtMsg.disabled=false;
		//document.myForm1.btnSend.disabled=false;
		//document.myForm1.btnClear.disabled=false;		
	}
}
function setup_support(){
	var dt;
	var uid;

	dt=new Date();
	document.myForm1.txtDt.value=dt;
	uid=document.myForm1.userid.value;
	//hideInquiryForm();
	if (uid == ""){
		if (document.getElementById('welcomeMsg')){
			document.getElementById('welcomeMsg').style.display="none";
			welcomeMsg.style.visibility="hidden";
		}else{
			document.getElementById('welcomeMsg').style.display="";
			welcomeMsg.style.visibility="hidden";
		}
		if (document.getElementById('signOnPanel')){
			document.getElementById('signOnPanel').style.display="";
			signOnPanel.style.visibility="visible";
		}else{
			document.getElementById('signOnPanel').style.display="none";
			signOnPanel.style.visibility="hidden";
		}
		document.getElementById('memberMenu').style.display="none";
		//document.getElementById('onlineMenu').style.display="none";
	}else{
		if (document.getElementById('welcomeMsg')){
			document.getElementById('welcomeMsg').style.display="";
			document.getElementById('welcomeFname').innerHTML=uid;
			welcomeMsg.style.visibility="visible";
		}else{
			document.getElementById('welcomeMsg').style.display="none";
			welcomeMsg.style.visibility="hidden";
		}
		if (document.getElementById('signOnPanel')){
			document.getElementById('signOnPanel').style.display="none";
			signOnPanel.style.visibility="hidden";
		}else{
			document.getElementById('signOnPanel').style.display="";
			signOnPanel.style.visibility="hidden";
		}
	}
	document.getElementById('forgot').style.display="none";	
}
function setup_contact(){
	var uid;
	uid=document.myForm1.userid.value;
	//hideInquiryForm();
	if (uid == ""){
		if (document.getElementById('welcomeMsg')){
			document.getElementById('welcomeMsg').style.display="none";
			welcomeMsg.style.visibility="hidden";
		}else{
			document.getElementById('welcomeMsg').style.display="";
			welcomeMsg.style.visibility="hidden";
		}
		if (document.getElementById('signOnPanel')){
			document.getElementById('signOnPanel').style.display="";
			signOnPanel.style.visibility="visible";
		}else{
			document.getElementById('signOnPanel').style.display="none";
			signOnPanel.style.visibility="hidden";
		}
		document.getElementById('memberMenu').style.display="none";
		//document.getElementById('onlineMenu').style.display="none";
	}else{
		if (document.getElementById('welcomeMsg')){
			document.getElementById('welcomeMsg').style.display="";
			document.getElementById('welcomeFname').innerHTML=uid;
			welcomeMsg.style.visibility="visible";
		}else{
			document.getElementById('welcomeMsg').style.display="none";
			welcomeMsg.style.visibility="hidden";
		}
		if (document.getElementById('signOnPanel')){
			document.getElementById('signOnPanel').style.display="none";
			signOnPanel.style.visibility="hidden";
		}else{
			document.getElementById('signOnPanel').style.display="";
			signOnPanel.style.visibility="hidden";
		}
	}
	hideInquiryForm();
	document.getElementById('forgot').style.display="none";
}
function setup_signup(){
	var uid;
	uid=document.myForm1.userid.value;
	//hideInquiryForm();
	if (uid == ""){
		if (document.getElementById('welcomeMsg')){
			document.getElementById('welcomeMsg').style.display="none";
			welcomeMsg.style.visibility="hidden";
		}else{
			document.getElementById('welcomeMsg').style.display="";
			welcomeMsg.style.visibility="hidden";
		}
		if (document.getElementById('signOnPanel')){
			document.getElementById('signOnPanel').style.display="";
			signOnPanel.style.visibility="visible";
		}else{
			document.getElementById('signOnPanel').style.display="none";
			signOnPanel.style.visibility="hidden";
		}
		document.getElementById('memberMenu').style.display="none";
		//document.getElementById('onlineMenu').style.display="none";
	}else{
		if (document.getElementById('welcomeMsg')){
			document.getElementById('welcomeMsg').style.display="";
			document.getElementById('welcomeFname').innerHTML=uid;
			welcomeMsg.style.visibility="visible";
		}else{
			document.getElementById('welcomeMsg').style.display="none";
			welcomeMsg.style.visibility="hidden";
		}
		if (document.getElementById('signOnPanel')){
			document.getElementById('signOnPanel').style.display="none";
			signOnPanel.style.visibility="hidden";
		}else{
			document.getElementById('signOnPanel').style.display="";
			signOnPanel.style.visibility="hidden";
		}
	}
	document.getElementById('othIntrst').style.display="none";
	document.getElementById('forgot').style.display="none";
}


function validateLogin(){
	var uid, pwd, strMsg="";
	uid=document.myForm1.uid.value;
	pwd=document.myForm1.pwd.value;
	if (uid == ""){
		strMsg+="User ID is Blank\n";
	}
	if (pwd == ""){
		strMsg+="Password is Blank\n";
	}
	if (strMsg != ""){
		window.alert("Warning!\n\n"+strMsg);
	}else{
		document.location.href="valiLogin.php?uid="+uid+"&pwd="+pwd;
	}	
}
function menuAction1(val1){
	if (val1 == "0"){
		if (document.getElementById('menu1').style.display=="none"){
			document.getElementById('menu1').style.display="";
		}else{
			document.getElementById('menu1').style.display="none"
		}
	}
	window.status="Professional Video";
}
function menuAction2(val1){
	if (val1 == "0"){
		if (document.getElementById('menu2').style.display=="none"){
			document.getElementById('menu2').style.display="";
		}else{
			document.getElementById('menu2').style.display="none"
		}
	}
	window.status="Equipment Rental";
}
function menuAction3(val1){
	if (val1 == "0"){
		if (document.getElementById('menu3').style.display=="none"){
			document.getElementById('menu3').style.display="";
		}else{
			document.getElementById('menu3').style.display="none"
		}
	}
	window.status="Equipment Sales";
}
function menuAction4(val1){
	if (val1 == "0"){
		if (document.getElementById('menu4').style.display=="none"){
			document.getElementById('menu4').style.display="";
		}else{
			document.getElementById('menu4').style.display="none"
		}
	}
	window.status="Security Systems";
}
function menuAction5(val1){
	if (val1 == "0"){
		if (document.getElementById('menu5').style.display=="none"){
			document.getElementById('menu5').style.display="";
		}else{
			document.getElementById('menu5').style.display="none"
		}
	}
	window.status="Extended Services";
}
function logOut(){
	var userFname="";
	window.location.href="index.php?userFname="+userFname;
}
function loadPage(val1, val2){
	var uid, items, userid1, style0;
	uid=document.myForm1.userid.value;
	items=document.myForm1.items.value;
	userid1=document.myForm1.userid1.value;
	style0=document.myForm1.style0.value;
	switch(val1){
		case 1:
			switch(val2){
				case 1:
					window.location.href="proVideo_weddings.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					window.location.href="proVideo_birthdays.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 3:
					window.location.href="proVideo_others.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;										
			}
			break;
		case 2:
			switch(val2){
				case 1:
					window.location.href="rental_sound.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					window.location.href="rental_lighting.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 3:
					window.location.href="rental_dj.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 4:
					window.location.href="rental_staging.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;															
			}
			break;		
		case 3:
			switch(val2){
				case 1:
					window.location.href="sale_sound.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					window.location.href="sale_lighting.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 3:
					window.location.href="sale_dj.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 4:
					window.location.href="sale_laser.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;															
			}
			break;		
		case 4:
			switch(val2){
				case 1:
					window.location.href="security_camera.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					window.location.href="security_accesscontrol.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 3:
					window.location.href="security_pointofsales.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 4:
					window.location.href="security_alarmsystem.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;															
			}
			break;		
		case 5:
			switch(val2){
				case 1:
					window.location.href="online_videophotogallery.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					window.location.href="online_soundcollections.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 3:
					if (uid == ""){
						window.alert("Warning!\n\nThis option is available for Members Only.\n\nIf you are a member, please login now and Try Again.\n\nThank You\n");
					}else{
						window.location.href="online_videoreservation.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					}
					break;
				case 4:
					if (uid == ""){
						window.alert("Warning!\n\nThis option is available for Members Only.\n\nIf you are a member, please login now and Try Again.\n\nThank You\n");
					}else{
						items=document.myForm1.items.value;				
						window.location.href="online_rentalreservation.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					}
					break;
				case 5:
					window.location.href="our_offers.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 6:
					window.location.href="job_desc.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;															
			}
			break;		
		case 6:
			switch(val2){
				case 1:
					window.location.href="member_changeprofile.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					window.location.href="member_changepassword.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
			}
			break;		
		case 7:
			switch(val2){
				case 1:
					window.location.href="index.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					window.location.href="aboutus.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 3:
					window.location.href="commercials.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 4:
					window.location.href="support.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 5:
					window.location.href="contactus.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
			}
			break;							
		case 8:
			switch(val2){
				case 1:
					window.location.href="contact_email.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
			}
			break;
		case 9:
			switch(val2){
				case 1:
					window.location.href="signup.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					document.myForm1.txtId.value="";
					if (document.getElementById('forgot').style.display=="none"){
						document.getElementById('forgot').style.display="";
						forgot.style.visibility="visible";
					}else{
						document.getElementById('forgot').style.display="none";
						forgot.style.visibility="hidden";
					}				
					//window.location.href="forgotpwd.php?userFname="+uid;
					break;					
			}
			break;
		case 10:
			switch(val2){
				case 1:
					window.location.href="extend_web.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					window.location.href="extend_ads.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 3:
					window.location.href="extend_photo.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 4:
					window.location.href="extend_partydecor.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 5:
					window.location.href="extend_album.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;																				
			}
			break;
		case 11:
			switch(val2){
				case 1:
					window.location.href="more_videos.php?userFname="+uid+"&items="+items+"&userid="+userid1+"&style0="+style0;
					break;
				case 2:
					window.open('Privacy.php','TeknoMediaPrivacyStatement','height=470,width=600,toolbar=yes,scrollbars=yes,resizable=no,status=yes,copyhistory=yes,location=yes,menubar=yes');
					break;
				case 3:
					window.open('Extended_VideoLogo.php','TeknoMediaVideoSamples','height=300,width=600,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,copyhistory=no,location=yes,menubar=yes');
					break;
				case 4:
					window.open('Extended_VideoTeknoTV.php','TeknoMediaVideoSamples','height=300,width=600,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,copyhistory=no,location=yes,menubar=yes');
					break;
				case 5:
					window.open('Extended_Video1.php','TeknoMediaVideoSamples','height=300,width=600,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,copyhistory=no,location=yes,menubar=yes');
					break;
				case 6:
					window.open('Extended_Video2.php','TeknoMediaVideoSamples','height=300,width=600,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,copyhistory=no,location=yes,menubar=yes');
					break;
				case 7:
					window.open('Extended_Video3.php','TeknoMediaVideoSamples','height=300,width=600,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,copyhistory=no,location=yes,menubar=yes');
					break;
				case 8:
					window.open('Extended_Video4.php','TeknoMediaVideoSamples','height=300,width=600,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,copyhistory=no,location=yes,menubar=yes');
					break;
				case 9:
					window.open('Extended_Video5.php','TeknoMediaVideoSamples','height=300,width=600,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,copyhistory=yes,location=yes,menubar=yes');
					break;
				case 10:
					window.open('Extended_Video6.php','TeknoMediaVideoSamples','height=300,width=600,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,copyhistory=yes,location=yes,menubar=yes');
					break;
			}
			break;							
	}
}
function dispInquiryForm(){
	if (document.getElementById('onlineInquiry1').style.display=="none"){
		document.getElementById('onlineInquiry1').style.display="";
		onlineInquiry1.style.visibility="visible";
	}else{
		document.getElementById('onlineInquiry1').style.display="none";
		onlineInquiry1.style.visibility="hidden";
	}
}
function hideInquiryForm(){
	document.getElementById('onlineInquiry1').style.display="none";
}
function sendMsg(var1){
	var obj
	var errMsg="";
	var msgFrom, msgTo, msgBody, msgSubj;
	msgFrom="admin@teknomediaonline.com";
	msgTo=document.myForm1.txtEmail.value;
	msgSubj=document.myForm1.txtSubject.value;
	if (document.myForm1.txtFname.value == ""){
		errMsg += "Full Name is empty\n";
	}
	if (msgTo == ""){
		errMsg += "Email is empty\n";
	}else{
		if (isValidEmail(msgTo) == false){
			errMsg += "Email is Invalid\n";
		}
	}
	if (document.myForm1.txtPhone.value == ""){
		errMsg += "Phone number is empty\n";
	}else{
		if (isValidPhone(document.myForm1.txtPhone.value) == false){
			errMsg += "Phone number is Invalid\n";
		}
	}
	if (document.myForm1.txtSubject.value == ""){
		errMsg += "Subject is empty\n";
	}
	if (document.myForm1.txtMsg.value == ""){
		errMsg += "Message is empty\n";
	}
	if ((document.myForm1.chk11.checked == false) && (document.myForm1.chk12.checked == false)){
		errMsg += "Contact Method is not selected\n";
	}
	if ((document.myForm1.chk21.checked == false) && (document.myForm1.chk22.checked == false)){
		errMsg += "Preferred language is not selected\n";
	}
	if (errMsg !=""){
		window.alert("Warning!\n\n"+errMsg);
	}else{
		msgBody="NAME :"+document.myForm1.txtFname.value+"****";
		msgBody+="PHONE:"+document.myForm1.txtPhone.value+"****";
		msgBody+="CONTACT METHOD:";
		if (document.myForm1.chk11.checked == true){
			msgBody+="Email";
		}
		if (document.myForm1.chk12.checked == true){
			if (document.myForm1.chk11.checked == true){
				msgBody+=", Phone";
			}else{
				msgBody+="Phone";
			}
		}
		msgBody+="****";
		msgBody+="PREFERRED LANGUAGE:";
		if (document.myForm1.chk21.checked == true){
			msgBody+="English";
		}
		if (document.myForm1.chk22.checked == true){
			if (document.myForm1.chk21.checked == true){
				msgBody+=", Tamil";
			}else{
				msgBody+="Tamil";
			}
		}
		msgBody+="****MESSAGE: ";
		msgBody+=document.myForm1.txtMsg.value;		
		obj=sendEmail(msgTo, msgSubj, msgBody);
		//hiding form
		if (var1 == 0){
			dispInquiryForm();
		}
		clrMsg();
		//displaying message to the user
		window.alert("Hi "+ document.myForm1.txtFname.value + "!\n\n" + "Your message has been sent successfully!!\n\nThank You.\n\n" );
		obj.close();
	}						
}
function clrMsg(){
	document.myForm1.txtFname.value="";
	document.myForm1.txtEmail.value="";
	document.myForm1.txtPhone.value="";
	document.myForm1.txtSubject.value="";
	document.myForm1.txtMsg.value="";
	document.myForm1.chk11.checked=false;
	document.myForm1.chk12.checked=false;
	document.myForm1.chk21.checked=false;
	document.myForm1.chk22.checked=false;
}
function sendEmail(msgTo, msgSubj, msgBody){
	var url, sendWin, msgFrom;
	msgFrom="";
	url="sendMail.php?msgFrom="+msgFrom+"&msgTo="+msgTo+"&msgSubj="+msgSubj+"&msgBody="+msgBody;
	sendWin=window.open(url, "sendWin", "width=100, height=100");
	return sendWin;
}
function switchTxtBox(){
	if (document.myForm1.chkOther.checked == true){
		document.getElementById('othIntrst').style.display="";
	}else{
		document.getElementById('othIntrst').style.display="none";
	}
}
function signupSave(){
	var errMsg="", obj, obj1, obj2, msgBody;
	var fName, lName, hNo, st, city, pro, pcode, country, hPh, mPh, wPh, email, chkVideo, chkRental, chkSale, chkSecSys, chkOther, other;
	fName=document.myForm1.txtFname.value;
	lName=document.myForm1.txtLname.value;
	hNo=document.myForm1.txtHno.value;
	st=document.myForm1.txtStreet.value;
	city=document.myForm1.lstCity.options[document.myForm1.lstCity.selectedIndex].text;
	pro=document.myForm1.txtPro.value;
	pcode=document.myForm1.txtPcode.value;
	country=document.myForm1.txtCountry.value;
	hPh=document.myForm1.txtPhome.value;
	mPh=document.myForm1.txtPmobile.value;
	wPh=document.myForm1.txtPwork.value;
	email=document.myForm1.txtEmail.value;
	chkVideo=document.myForm1.chkPvideo.checked;
	chkRental=document.myForm1.chkRental.checked;
	chkSale=document.myForm1.chkSale.checked;
	chkSecSys=document.myForm1.chkSecSys.checked;
	chkOther=document.myForm1.chkOther.checked;
	other=document.myForm1.txtOther.value;
	
	if (fName == ""){
		errMsg+="First Name is Blank\n";
	}
	if (lName == ""){
		errMsg+="Last Name is Blank\n";
	}
	if (hNo == ""){
		errMsg+="House/Apt Number is Blank\n";
	}
	if (st == ""){
		errMsg+="Street Name is Blank\n";
	}
	if (pcode == ""){
		errMsg+="Postal Code is Blank\n";
	}
	if (hPh == "" && mPh == "" && wPh == ""){
		errMsg+="Phone Numbers are Blank\n";
	}
	if (hPh != ""){
		if (isValidPhone(hPh) == false){
			errMsg+="Home Phone number is Invalid\n";
		}
	}
	if (mPh != ""){
		if (isValidPhone(mPh) == false){
			errMsg+="Mobile Phone number is Invalid\n";
		}
	}
	if (wPh != ""){
		if (isValidPhone(wPh) == false){
			errMsg+="Work Phone number is Invalid\n";
		}
	}
	if (email == ""){
		errMsg+="Email is Blank\n";
	}else{
		if (isValidEmail(email) == false){
			errMsg+="Email is Invalid\n";
		}
	}
		
	if (chkVideo == false && chkRental == false && chkSale == false && chkSecSys == false && chkOther == false){
		errMsg+="Non of your Interested Items Selected\n";
	}
	if (chkOther == true && other==""){
		errMsg+="Other Interested Item is Blank\n";
	}
	if (errMsg != ""){
		window.alert("Warning!\n\n"+errMsg);
	}else{
		obj=userRegister(fName, lName, hNo, st, city, pro, pcode, country, hPh, mPh, wPh, email, chkVideo, chkRental, chkSale, chkSecSys, chkOther, other);
		signupClr();
		//obj.close();
		//displaying message to the user
		//message to admin
		
		msgBody="Name:"+fName+" - "+lName+" **** Address:"+ hNo + " - " + st +" - " + city;
		//window.alert(testEmail);
		obj1=sendEmail1(fName, email, "Teknomedia OnLine - Registration Confirmation", msgBody);
		//window.alert("Hi "+ fName + "!\n\n" + "Thank You for Signing up with us\n\nYour regitration will be verified and your login information will be sent soon\n\n" );
		window.alert("Hi "+ fName + "!\n\n" + "Thank you for choosing Tekno Media!\n\nYour registration is successful. You will receive an official email from Tekno Media within the next 24 hrs with your confirmed username and password. After you have received your credentials by email you may login to the site.\n\nWe thank you for your patience.\n\nAdmin, Teknomedia Online");
		//message to new user
		//msgBody="Dear "+fName+"**** Thank you for signing up with us. our regitration will be verified and your login information will be sent soon - Admin, Teknomedia On Line ****";
		//obj2=sendEmail(email, "Teknomedia OnLine - Registration Confirmation", msgBody);
		obj.close();
		obj1.close();
		obj2.close();
	}
}
function userRegister(fName, lName, hNo, st, city, pro, pcode, country, hPh, mPh, wPh, email, chkVideo, chkRental, chkSale, chkSecSys, chkOther, other){

	var url="", regdWin;
	
	url="regdPage.php?fName="+fName+"&lName="+lName+"&hNo="+hNo+"&st="+st+"&city="+city+"&pro="+pro+"&pcode="+pcode+"&country="+country+"&hPh="+hPh+"&mPh="+mPh+"&wPh="+wPh+"&email="+email;
	
	if (chkVideo == true){
		url+="&chkVideo=1";
	}else{
		url+="&chkVideo=0";
	}
	if (chkRental == true){
		url+="&chkRental=1";
	}else{
		url+="&chkRental=0";
	}
	if (chkSale == true){
		url+="&chkSale=1";
	}else{
		url+="&chkSale=0";
	}
	if (chkSecSys == true ){
		url+="&chkSecSys=1";
	}else{
		url+="&chkSecSys=0";
	}
	if (chkOther == true){
		url+="&chkOther=1";
	}else{
		url+="&chkOther=0";
	}
	url+="&other="+other;
	
	//window.alert(url);
	regdWin=window.open(url, "regdWin", "width=100, height=100");
	return regdWin;
}
function signupClr(){
	document.myForm1.txtFname.value="";
	document.myForm1.txtLname.value="";
	document.myForm1.txtHno.value="";
	document.myForm1.txtStreet.value="";
	document.myForm1.lstCity.selectedIndex=0;
	document.myForm1.txtPro.value="";
	document.myForm1.txtPcode.value="";
	document.myForm1.txtCountry.value="";
	document.myForm1.txtPhome.value="";
	document.myForm1.txtPmobile.value="";
	document.myForm1.txtPwork.value="";
	document.myForm1.txtEmail.value="";
	document.myForm1.chkPvideo.checked=false;
	document.myForm1.chkRental.checked=false;
	document.myForm1.chkSale.checked=false;
	document.myForm1.chkSecSys.checked=false;
	document.myForm1.chkOther.checked=false;
	document.myForm1.txtOther.value="";
	document.getElementById('othIntrst').style.display="none";	
}
function setup_ItemMaster(){
	var catId, subCatId, itemId, i, upd, access;

	upd=document.myForm.upd.value;
	catId=document.myForm.catId.value;
	subCatId=document.myForm.subCatId.value;
	itemId=document.myForm.itemId.value;
		
	if (catId != ""){
		for (i=0; i<document.myForm.lstCat.length; i++){
			if (document.myForm.lstCat[i].value == catId){
				document.myForm.lstCat.selectedIndex = i;
				break;
			}
		}
	}else{
		document.myForm.lstCat.selectedIndex = 0;
	}
	if (subCatId != ""){
		for (i=0; i<document.myForm.lstSubCat.length; i++){
			if (document.myForm.lstSubCat[i].value == subCatId){
				document.myForm.lstSubCat.selectedIndex = i;
				break;
			}
		}
	}else{
		document.myForm.lstSubCat.selectedIndex = 0;
	}
	if (itemId != ""){
		for (i=0; i<document.myForm.lstItems.length; i++){
			if (document.myForm.lstItems[i].value == itemId){
				document.myForm.lstItems.selectedIndex = i;
				break;
			}
		}
	}else{
		document.myForm.lstItems.selectedIndex = 0;
	}
	if (document.myForm.lstItems.selectedIndex == 0){
		document.myForm.txtID.value="<New>";
		document.myForm.txtName.disabled=false;
		document.myForm.radYN[0].disabled=false;
		document.myForm.radYN[1].disabled=false;
		document.myForm.fileImg.disabled=false;
		document.myForm.chkRent.disabled=false;
		document.myForm.chkSale.disabled=false;
		document.myForm.txtDesc.disabled=false;
		if (upd == "Y"){
			document.myForm.btnModify.disabled=true;
			document.myForm.btnSave.disabled=false;
		}else{
			document.myForm.btnModify.disabled=true;
			document.myForm.btnSave.disabled=true;
		}
	}else{
		document.myForm.txtID.readonly=true;
		document.myForm.txtName.disabled=true;
		document.myForm.radYN[0].disabled=true;
		document.myForm.radYN[1].disabled=true;
		document.myForm.fileImg.disabled=true;
		document.myForm.chkRent.disabled=true;
		document.myForm.chkSale.disabled=true;
		document.myForm.txtDesc.disabled=true;
		if (upd == "Y"){
			document.myForm.btnModify.disabled=false;
			document.myForm.btnSave.disabled=true;
		}else{
			document.myForm.btnModify.disabled=true;
			document.myForm.btnSave.disabled=true;
		}
	}
}
function loadSubCat(){
	var catId, upd;
	upd=document.myForm.upd.value;
	catId=document.myForm.lstCat.options[document.myForm.lstCat.selectedIndex].value;
	window.location.href="itemMaster.php?catId="+catId+"&upd="+upd;
}
function loadItems(){
	var catId, subCatId, upd;
	upd=document.myForm.upd.value;
	catId=document.myForm.lstCat.options[document.myForm.lstCat.selectedIndex].value;
	subCatId=document.myForm.lstSubCat.options[document.myForm.lstSubCat.selectedIndex].value;
	window.location.href="itemMaster.php?catId="+catId+"&subCatId="+subCatId+"&upd="+upd;
}
function loadDetails(){
	var idx, itemId, catId, subCatId, upd, access;
	idx=document.myForm.lstItems.selectedIndex;
	access=parent.frames[1].document.myForm1.access.value;
	//window.alert(access + " "+ idx);
	if (access == "superadmin" && idx>0){
		//window.alert("true");
		document.myForm.butDelete.disabled=false;
	}else{
		//window.alert("false");
		document.myForm.butDelete.disabled=true;
	}	
	upd=document.myForm.upd.value;
	if (idx == 0){
		if (upd != "Y"){
			window.alert("Sorry.. You have no permission to add new items!");
			return;
		}
		document.myForm.txtID.value="<New>";
		document.myForm.txtName.value="";
		document.myForm.radYN[0].checked=true;
		document.myForm.fileImg.value="";
		document.myForm.chkRent.checked=false;
		document.myForm.chkSale.checked=false;
		document.myForm.txtDesc.value="";
		document.myForm.mode.value="NEW";
		
		document.myForm.txtID.value="<New>";
		document.myForm.txtName.disabled=false;
		document.myForm.radYN[0].disabled=false;
		document.myForm.radYN[1].disabled=false;
		document.myForm.fileImg.disabled=false;
		document.myForm.chkRent.disabled=false;
		document.myForm.chkSale.disabled=false;
		document.myForm.txtDesc.disabled=false;
		if (upd == "Y"){
			document.myForm.btnModify.disabled=true;
			document.myForm.btnSave.disabled=false;		
		}else{
			document.myForm.btnModify.disabled=true;
			document.myForm.btnSave.disabled=true;
		}
	}else{
		itemId=document.myForm.lstItems.options[document.myForm.lstItems.selectedIndex].value;
		catId=document.myForm.lstCat.options[document.myForm.lstCat.selectedIndex].value;
		subCatId=document.myForm.lstSubCat.options[document.myForm.lstSubCat.selectedIndex].value;
		window.location.href="itemMaster.php?catId="+catId+"&subCatId="+subCatId+"&itemId="+itemId+"&upd="+upd+"&access="+access;
	}
}
function saveRec(){
	var mode, itemID, itemName, itemDesc, active, forSale, forRent, imgUrl, pic_url, subCatId, catId, url;
	var regWin, strErr="";
	itemID=document.myForm.txtID.value;
	if (itemID == "<New>"){
		mode = "NEW";
	}else{
		mode = "UPD";
	}
	//mode=iif((itemID == "New") ? "NEW" : "UPD"); 
	itemName=document.myForm.txtName.value;
	itemDesc=document.myForm.txtDesc.value;
	imgUrl=document.myForm.fileImg.value;
	if (document.myForm.radYN[0].checked){
		active='Y';
	}else{
		active='N';
	}
	if (document.myForm.chkSale.checked){
		forSale='Y';
	}else{
		forSale='N';
	}
	if (document.myForm.chkRent.checked){
		forRent='Y';
	}else{
		forRent='N';
	}	
	//active=iif(document.myForm.radYN[0].checked ? 'Y' : 'N');
	//forSale=iif(document.myForm.chkSale.checked ? 'Y', 'N');
	//forRent=iif(document.myForm.chkRent.checked ? 'Y', 'N');
	catId=document.myForm.catId.value;
	subCatId=document.myForm.subCatId.value;
	
	if (itemName == ""){
		strErr+="Item Name is Empty\n";
	}
	if (catId == ""){
		strErr+="Category not selected\n";
	}
	if (subCatId == ""){
		strErr+="Sub Category not selected\n";
	}
	if (strErr != ""){
		window.alert("Warning!\n\n"+strErr);		
	}else{
		document.myForm.catId1.value=catId;
		document.myForm.subCatId1.value=subCatId;
		document.myForm.itemId1.value=itemID;
		document.myForm.itemName1.value=itemName;
		document.myForm.mode1.value=mode;
		document.myForm.active1.value=active;
		document.myForm.forSale1.value=forSale;
		document.myForm.forRent1.value=forRent;
		document.myForm.itemDesc1.value=itemDesc;
		document.myForm.url1.value=imgUrl;
		
		setTimeout(document.myForm.submit(),9000);
		
		//url="saveItems.php?itemID="+itemID+"&mode="+mode+"&itemName="+itemName+"&imgUrl="+imgUrl+"&active="+active+"&forSale="+forSale+"&forRent="+forRent+"&catId="+catId+"&subCatId="+subCatId+"&itemDesc="+itemDesc;
		//window.alert(itemID+"|"+mode+"|"+itemName+"|"+imgUrl+"|"+active+"|"+forSale+"|"+forRent+"|"+catId+"|"+subCatId+"|"+itemDesc);
		//parent.frames[4].location.href=url;
		window.alert("Record Saved Successfully!");
	}
}
function modyRec(){
	document.myForm.txtName.disabled=false;
	document.myForm.radYN[0].disabled=false;
	document.myForm.radYN[1].disabled=false;
	document.myForm.fileImg.disabled=false;
	document.myForm.chkRent.disabled=false;
	document.myForm.chkSale.disabled=false;
	document.myForm.txtDesc.disabled=false;
	document.myForm.mode.value="UPD";
	document.myForm.btnSave.disabled=false;
}
function loadPic(){
	document.images[0].src=document.myForm.fileImg.value;
}
function saveConfig(){
	var txtEmail, url, txtStyle;
	txtEmail=document.myForm1.txtEmail.value;
	txtStyle=document.myForm1.menuStyle.options[document.myForm1.menuStyle.selectedIndex].value;
	url="saveConfig.php?email="+txtEmail+"&txtStyle="+txtStyle;
	parent.frames[4].location.href=url;
}
function sendFeedback(){
	var obj;
	var name, email, msg, errMsg;
	name=document.myForm1.txtName.value;
	email=document.myForm1.txtEmail.value;
	msg=document.myForm1.txtMsg.value;
	
	errMsg="";
	if (name == ""){
		errMsg+="Name is Empty\n";
	}
	if (email == ""){
		errMsg+="Email is Empty\n";
	}else{
		if (isValidEmail(email) == false){
			errMsg+="Email is Invalid\n";
		}	
	}
	if (msg == ""){
		errMsg+="Feedback Message is Empty\n";
	}
	if (errMsg != ""){	
		window.alert("Warning!\n\n"+errMsg+"\n");
	}else{
		obj=sendEmail1(name, email, "Feedback", msg);
		window.alert("Hi "+name+"\n\n"+"Thank You for your Feedback\n");
		clrFeedback();
		obj.close();
	}
}

function clrFeedback(){
	document.myForm1.txtName.value="";
	document.myForm1.txtEmail.value="";
	document.myForm1.txtMsg.value="";
}
function sendEmail1(name, msgTo, msgSubj, msgBody){
	var url, sendWin, msgFrom;
	msgFrom="";
	url="sendMail1.php?name="+name+"&msgTo="+msgTo+"&msgSubj="+msgSubj+"&msgBody="+msgBody;
	sendWin=window.open(url, "sendWin", "width=100, height=100");
	return sendWin;
}
function sendInquiry(){
	var bizName, bizType, addr, contact, phone, email, email1, msg, errMsg, str, obj;
	bizName=document.myForm1.txtBizName.value;
	bizType=document.myForm1.txtBizType.value;
	addr=document.myForm1.txtAddress.value;
	contact=document.myForm1.txtContact.value;
	phone=document.myForm1.txtPhone.value;
	email=document.myForm1.txtEmail.value;
	msg=document.myForm1.txtMsg.value;
	
	errMsg="";
	if (bizName == ""){
		errMsg+="Business Name is empty\n";
	}
	if (bizType == ""){
		errMsg+="Business Type is empty\n";
	}
	if (addr == ""){
		errMsg+="Address is empty\n";
	}	
	if (contact == ""){
		errMsg+="Contact Name is empty\n";
	}
	if (phone == ""){
		errMsg+="Contact Phone is empty\n";
	}else{
		if (isValidPhone(phone)==false){
			errMsg+="Contact Phone is Invalid\n";
		}
	}
	if (email == ""){
		errMsg+="Email is empty\n";
	}else{
		if (isValidEmail(email) == false){
			errMsg+="Email is Invalid\n";
		}
	}
	if (msg == ""){
		errMsg+="Message is empty\n";
	}
	if (errMsg != ""){
		window.alert("Warning:\n\n"+errMsg+"\n");
	}else{
		str="Business Name:"+bizName+"\nBusiness Type:"+bizType+"\nAddrsss:"+addr+"\nContact:"+contact+"\nphone:"+phone+"\nEmail:"+email+"\nMessage:"+msg;
		//window.alert(str);
		obj=sendEmail1(contact, email, "Commercial Inquiry", str);
		window.alert("Thank you for your inquiry with us.\nWe will get back you soon\n\n");
		clrInquiry();
		obj.close();
	}					
}
function clrInquiry(){
	document.myForm1.txtBizName.value="";
	document.myForm1.txtBizType.value="";
	document.myForm1.txtAddress.value="";
	document.myForm1.txtContact.value="";
	document.myForm1.txtPhone.value="";
	document.myForm1.txtEmail.value="";
	document.myForm1.txtMsg.value="";
}
function forgotClick(){
	//sending request
	var memberId, obj;
	memberId=document.myForm1.txtId.value;
	if (memberId == ""){
		window.alert("Please Enter Your\nMember ID\n");
	}else{
		//send info to get password
		obj=getPassword(memberId);
		window.alert("You password request is successful! \n\nAn email has been sent it to your email address that you have activated in Tekno Media database. Please check your password by logging into your email account. If you have further question about this, please contact us by toll free number 1888 953 2727 or mailto: info@teknomediaonline.com.\n\nThank you for choosing Tekno Media!\n\n- Admin, Tekno Media Online.\n");
		forgotCancel();
		obj.close();
	}
}
function forgotCancel(){
	document.myForm1.txtId.value="";
	document.getElementById('forgot').style.display="none";
	forgot.style.visiblity="hidden";
}
function getPassword(memId){
	var url;
	url="getPwd.php?memId="+memId;
	sendWin=window.open(url, "sendWin", "width=100, height=100");
	return sendWin;
}
function setAddPic(){
	document.myForm1.btnAddPic.disabled=false;
	document.myForm1.btnRemovePic.disabled=true;
}
function addPicture(){
	var picUrl, arr, pic;
	picUrl=document.myForm1.fileImg.value;
	arr=picUrl.split("\\");
	pic=arr[arr.length-1];

	if (picUrl != ""){
		if (document.myForm1.lstAttch.length == 0){
			document.myForm1.lstAttch.options[0] = new Option(pic, picUrl);
		}else{
			document.myForm1.lstAttch.options[document.myForm1.lstAttch.length] = new Option(pic, picUrl);
		}
	}
	document.myForm1.fileImg.value="";
	document.myForm1.btnAddPic.disabled=true;
	document.myForm1.btnRemovePic.disabled=true;
}
function attchClick(){
	if (document.myForm1.lstAttch.selectedIndex >=0){
		document.myForm1.btnAddPic.disabled=true;
		document.myForm1.btnRemovePic.disabled=false;
	}
}
function remPicture(){
	document.myForm1.lstAttch.remove(document.myForm1.lstAttch[document.myForm1.lstAttch.selectedIndex].text);
	//document.myForm1.lstAttch.remove(document.myForm1.lstAttch.selectedIndex);
	document.myForm1.btnAddPic.disabled=true;
	document.myForm1.btnRemovePic.disabled=true;
	//document.myForm1.lstAttch[document.myForm1.lstAttch.selectedIndex].selected = false;
}
function sendRequest(){
	var name, addr, email, ph, msg, errMsg="", i, pics="", picurls="";
	//name=document.myForm1.txtName.value;
	//addr=document.myForm1.txtAddress.value;
	//email=document.myForm1.txtEmail.value;
	//ph=document.myForm1.txtPhone.value;
	msg=document.myForm1.txtMsg.value;
	
	//if (name == ""){
	//	errMsg+="Name is Empty\n";
	//}
	//if (addr == ""){
	//	errMsg+="Address is Empty\n";
	//}
	//if (email == ""){
	//	errMsg+="Email is Empty\n";
	//}else{
	//	if (isValidEmail(email) == false){
	//		errMsg+="Email is Invalid\n";
	//	}
	//}
	//if (ph == ""){
	//	errMsg+="Phone Number is Empty\n";
	//}else{
	//	if (isValidPhone(ph)==false){
	//		errMsg+="Contact Phone is Invalid\n";
	//	}	
	//}
	if (document.myForm1.lstAttch.length <= 0){
		errMsg+="Images not Selected\n";
	}
	if (errMsg != ""){
		window.alert("Warning!\n\n"+errMsg+"\n");
	}else{
		for(i=0; i<document.myForm1.lstAttch.length; i++){
			if (pics == ""){
				pics=document.myForm1.lstAttch.options[i].text;
			}else{
				pics+="|"+document.myForm1.lstAttch.options[i].text;
			}
			if (picurls == ""){
				picurls=document.myForm1.lstAttch.options[i].value;
			}else{
				picurls+="|"+document.myForm1.lstAttch.options[i].value;
			}			
		}
		//window.alert(pics+"\n"+picurls);
		document.myForm1.pics.value=pics;
		document.myForm1.picUrls.value=picurls;
		
		window.alert("Your request is successfully received\n\nOne of our representative will contact you as soon as possible\nfor further details\n\nThank You!\n");
	}	
}
function clrRequest(){
	var i;
	//document.myForm1.txtName.value="";
	//document.myForm1.txtAddress.value="";
	//document.myForm1.txtEmail.value="";
	//document.myForm1.txtPhone.value="";
	document.myForm1.txtMsg.value="";
	document.myForm1.fileImg.value="";
}
function chkType(){
	if (document.myForm1.lstType.selectedIndex == 2){
		document.getElementById('txtOther').style.display="";
	}else{
		document.getElementById('txtOther').style.display="none";
	}
	if (document.myForm1.lstType.selectedIndex == 0){
		document.getElementById('bday').style.visibility="visible";
	}else{
		document.getElementById('bday').style.visibility="hidden";
	}	
}
function sendResvRequest(){
	var userid, userid1, items, style0;
	var lstIdx, name, memId, txtCer, txtOth, txtDate, txtHall, txtAddr, txtPhone, txtMsg, errMsg="", url="", regdWin;
	var dob, timefrom, timeto, idx1, idx2;
	var obj, str;
	dob=document.myForm1.txtDob.value;
	timefrom=document.myForm1.timefrom.options[document.myForm1.timefrom.selectedIndex].value;
	timeto=document.myForm1.timeto.options[document.myForm1.timeto.selectedIndex].value;
	idx1=document.myForm1.timefrom.selectedIndex;
	idx2=document.myForm1.timeto.selectedIndex;
	name=document.myForm1.txtName.value;
	memId=document.myForm1.userid1.value;
	lstIdx=document.myForm1.lstType.selectedIndex;
	txtCer=document.myForm1.lstType[lstIdx].text;
	if (lstIdx == 2){
		txtOth=document.myForm1.txtOth.value;
	}else{
		txtOth="";
	}
	txtDate=document.myForm1.txtDate.value;
	txtHall=document.myForm1.txtHall.value;
	txtAddr=document.myForm1.txtAddr.value;
	txtPhone=document.myForm1.txtPhone.value;
	txtMsg=document.myForm1.txtMsg.value;
	
	if (lstIdx == 2 && txtOth == ""){
		errMsg+="Name of Ceremony is Empty\n";
	}
	if (txtDate == ""){
		errMsg+="Date of Ceremony is Empty\n";
	}else{
		if (isValidDate(txtDate) == false){
			errMsg+="Date of Ceremony is Invalid\n";
		}
	}
	if (timefrom == timeto){
		errMsg+="Srart and End times are same\n";
	}else{
		if (idx1 > idx2){
			errMsg+="Time selection is not in order\n";
		}
	}
	if (lstIdx == 0){
		if (dob == ""){
			errMsg+="Date of Birth is Empty\n";
		}else{
			if (isValidDate(dob) == false){
				errMsg+="Date of Birth is Invalid\n";
			}
		}
	}
	if (txtHall == ""){
		errMsg+="Name of Hall is Empty\n";
	}
	if (txtAddr == ""){
		errMsg+="Address of Hall is Empty\n";
	}
	if (txtPhone == ""){
		errMsg+="Phone of Hall is Empty\n";
	}else{
		if (isValidPhone(txtPhone) == false){
			errMsg+="Phone of Hall is Invalid\n";
		}
	}
	if (txtMsg == ""){
		errMsg+="Details of Ceremony is Empty\n";
	}
	if (errMsg != ""){					
		window.alert("Warning !\n\n"+errMsg+"\n");
	}else{
		userid=document.myForm1.userid.value;
		userid1=document.myForm1.userid1.value;
		items=document.myForm1.items.value;
		style0=document.myForm1.style0.value;
		
		str="MemberId:"+memId+"   Ceremony:"+txtCer+"  "+txtOth+"   Date of Ceremony:"+txtDate+"  Venue:"+txtHall+"   Address:"+txtAddr+"   Phone:"+txtPhone+"   Details:"+txtMsg;
		url="online_videoreservation.php?memId="+memId+"&txtCer="+txtCer+"&txtOth="+txtOth+"&txtDate="+txtDate+"&txtHall="+txtHall+"&txtAddr="+txtAddr+"&txtPhone="+txtPhone+"&txtMsg="+txtMsg+"&dob="+dob+"&timefrom="+timefrom+"&timeto="+timeto+"&str="+str+"&name="+name+"&mode=SAVE"+"&userFname="+userid+"&userid="+userid1+"&items="+items+"&style0="+style0;
		window.location.href=url;
		//window.alert(url);
		/*
		regdWin=window.open(url, "regdWin", "width=100, height=100");
		window.alert("Hi "+name+"\n\nThank you for placing reservation with us.\nWe will review your request and contact you for further details\n\n- Tekno Media Admin");
		str="MemberId:"+memId+"   Ceremony:"+txtCer+"  "+txtOth+"   Date of Ceremony:"+txtDate+"  Venue:"+txtHall+"   Address:"+txtAddr+"   Phone:"+txtPhone+"   Details:"+txtMsg;
		obj=sendEmail1(name, memId, "Video Reservation", str);		
		clrResvInquiry();
		regdWin.close();
		clrResvInquiry();
		obj.close();
		*/
	}
	
}
function clrResvInquiry(){
	document.myForm1.txtOth.value="";
	document.myForm1.txtDate.value="";
	document.myForm1.txtHall.value="";
	document.myForm1.txtAddr.value="";
	document.myForm1.txtPhone.value="";
	document.myForm1.txtMsg.value="";
}
function getSongs(){
	var txtFilm, txtDir, txtSing1, txtSing2, txtLang, uname, uid, items;
	txtFilm=document.myForm1.txtFilm.value;
	txtDir=document.myForm1.txtDir.value;
	txtSing1=document.myForm1.txtSinger1.value;
	txtSing2=document.myForm1.txtSinger2.value;
	txtLang=document.myForm1.lstLang.options[document.myForm1.lstLang.selectedIndex].text;
	uname=document.myForm1.userid.value;
	uid=document.myForm1.userid1.value;
	items=document.myForm1.items.value;
	window.location.href="online_soundcollections.php?txtLang="+txtLang+"&txtFilm="+txtFilm+"&txtDir="+txtDir+"&txtSing1="+txtSing1+"&txtSing2="+txtSing2+"&userFname="+uname+"&userid="+uid+"&items="+items;
}
function clrQry(){
	document.myForm1.txtFilm.value="";
	document.myForm1.txtDir.value="";
	document.myForm1.txtSinger1.value="";
	document.myForm1.txtSinger2.value="";
}
function songPageSetup(){
	var txtLang1, i;
	document.myForm1.btnLeft.disabled=true;
	document.myForm1.btnRight.disabled=true;
	txtLang1=document.myForm1.txtLang1.value;
	if (txtLang1 != ""){
		for(i=0; i<document.myForm1.lstLang.length; i++){
			if (document.myForm1.lstLang.options[i].text == txtLang1){
				document.myForm1.lstLang.selectedIndex=i;
				break;
			}
		}
	}else{
		document.myForm1.lstLang.selectedIndex=0;
	}
}
function loadProvince(){
	var country, i;
	country=document.myForm1.selCountry.options[document.myForm1.selCountry.selectedIndex].text;
	for (i=0; i<document.myForm1.selProvince.length; i++){
		document.myForm1.selProvince.remove(0);
		i--;
	}
	if (country == "Canada"){
		document.myForm1.txtCountry1.disabled=true;
		document.myForm1.txtProvince1.disabled=true;
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Alberta", "Alberta");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("British Colombia", "British Colombia");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Manitoba", "Manitoba");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("New Brunswick", "New Brunswick");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Newfoundland", "Newfoundland");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Norva Scotia", "Norva Scotia");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Northwest Territories", "Northwest Territories");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Nunavut", "Nunavut");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Ontario", "Ontario");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("PEI", "PEI");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Quebec", "Quebec");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Saskatchewan", "Saskatchewan");
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Yukon", "Yukon");	
	}else{
		document.myForm1.txtCountry1.disabled=false;
		document.myForm1.txtProvince1.disabled=false;
		document.myForm1.selProvince.options[document.myForm1.selProvince.length] = new Option("Other", "Other");
	}
}
function loadCity(){
	document.myForm1.txtCity.value="";
}
function citySave(){
	var country,country1, province, province1, city, url, err="";
	country=document.myForm1.selCountry.options[document.myForm1.selCountry.selectedIndex].text;
	country1=document.myForm1.txtCountry1.value;
	province=document.myForm1.selProvince.options[document.myForm1.selProvince.selectedIndex].text;
	province1=document.myForm1.txtProvince1.value;
	city=document.myForm1.txtCity.value;
	
	if (country == "Other"){
		if (country1 == ""){
			err+="Country Not Specified\n";
		}else{
			country=country1;
		}
	}
	if (province == "Other"){
		if (province1 == ""){
			err+="Province Not Specified\n";
		}else{
			province=province1;
		}
	}
	if (city == ""){
		err+="City Not Specified\n";
	}
	
	if (err == ""){
		url="saveCity.php?txtCountry="+country+"&txtProvince="+province+"&txtCity="+city;
		parent.frames[4].location.href=url;
		window.alert("Record Saved Successfully!");
		cityClr();
	}else{
		window.alert("Warning:\n\n"+err+"\n");
	}
}
function cityClr(){
	document.myForm1.txtCity.value="";
	document.myForm1.txtCountry1.value="";
	document.myForm1.txtProvince1.value="";
}
function setup_songMaster(){
	var upd;
	upd=document.myForm1.upd.value;
	if (document.myForm1.lstItems.selectedIndex == 0){
		document.myForm1.txtTitle.disabled=false;
		document.myForm1.txtMovie.disabled=false;
		document.myForm1.txtMusic.disabled=false;
		document.myForm1.txtSinger1.disabled=false;
		document.myForm1.txtSinger2.disabled=false;
		document.myForm1.lstLang.disabled=false;
		document.myForm1.lstType.disabled=false;
		document.myForm1.fileUrl.disabled=false;
		document.myForm1.chkActive.disabled=false;
	}else{
		document.myForm1.txtTitle.disabled=true;
		document.myForm1.txtMovie.disabled=true;
		document.myForm1.txtMusic.disabled=true;
		document.myForm1.txtSinger1.disabled=true;
		document.myForm1.txtSinger2.disabled=true;		
		document.myForm1.lstLang.disabled=true;
		document.myForm1.lstType.disabled=true;
		document.myForm1.fileUrl.disabled=true;
		document.myForm1.chkActive.disabled=true;	
	}
}
function dispDetails(){
	var str, astr, i, upd, access, idx;
	setup_songMaster();
	idx=document.myForm1.lstItems.selectedIndex;
	access=parent.frames[1].document.myForm1.access.value;
	if (access == "superadmin" && idx>0){
		document.myForm1.butDelete.disabled=false;
	}else{
		document.myForm1.butDelete.disabled=true;
	}	
	upd=document.myForm1.upd.value;
	if (document.myForm1.lstItems.selectedIndex == 0){
		if (upd != "Y"){
			window.alert("Sorry, you have no permission to add new items!");
			return;
		}
		document.myForm1.txtID.value="<NEW>";
		document.myForm1.txtTitle.value="";
		document.myForm1.txtMovie.value="";
		document.myForm1.txtMusic.value="";
		document.myForm1.txtSinger1.value="";
		document.myForm1.txtSinger2.value="";
		document.myForm1.lstLang.selectedIndex=0;
		document.myForm1.lstType.selectedIndex=0;
		document.myForm1.fileUrl.value="";
		document.myForm1.chkActive.checked=false;		
	}else{
		str=document.myForm1.lstItems.options[document.myForm1.lstItems.selectedIndex].value;
		astr=str.split("|");
		document.myForm1.txtID.value=astr[0];
		document.myForm1.txtTitle.value=astr[1];
		document.myForm1.txtMovie.value=astr[2];
		document.myForm1.txtMusic.value=astr[3];
		for(i=0; i<document.myForm1.lstLang.length; i++){
			if (document.myForm1.lstLang.options[i].text == astr[4]){
				document.myForm1.lstLang.options[i].selected = true;
				break;
			}
		}
		for(i=0; i<document.myForm1.lstType.length; i++){
			if (document.myForm1.lstType.options[i].text == astr[5]){
				document.myForm1.lstType.options[i].selected = true;
				break;
			}
		}
		document.myForm1.fileUrl.value="";
		if (astr[6] == "Y"){
			document.myForm1.chkActive.checked=true;
		}else{
			document.myForm1.chkActive.checked=false;
		}
		document.myForm1.txtSinger1.value=astr[7];
		document.myForm1.txtSinger2.value=astr[8];		
	}
}
function saveSongRec(){
	var txtID, mode, txtTitle, txtMovie, txtMusic, txtSinger1, txtSinger2, txtLang, txtType, txtUrl, txtActive, url, err="";
	if (document.myForm1.lstItems.selectedIndex == 0){
		mode="NEW";
	}else{
		mode="UPD";
	}
	txtID=document.myForm1.txtID.value;
	txtTitle=document.myForm1.txtTitle.value;
	txtMovie=document.myForm1.txtMovie.value;
	txtMusic=document.myForm1.txtMusic.value;
	txtSinger1=document.myForm1.txtSinger1.value;
	txtSinger2=document.myForm1.txtSinger2.value;
	txtUrl=document.myForm1.fileUrl.value;
	txtLang=document.myForm1.lstLang.options[document.myForm1.lstLang.selectedIndex].text;
	txtType=document.myForm1.lstType.options[document.myForm1.lstType.selectedIndex].text;
	if (document.myForm1.chkActive.checked){
		txtActive="Y";
	}else{
		txtActive="N";
	}
	if (txtTitle == ""){
		err+="Title is Blank\n";
	}
	if (txtMovie == ""){
		err+="Movie Name is Blank\n";
	}
	if (txtMusic == ""){
		err+="Music Director's Name is Blank\n";
	}
	if (txtSinger1 == "" && txtSinger2 == ""){
		err+="Singer's Name is Blank\n";
	}
	if (txtUrl == ""){
		if (mode == "NEW"){
			err+="Song selection is Blank\n";
		}
	}
	if (err == ""){
		//window.alert(mode+"\n"+txtID+"\n"+txtLang+"\n"+txtType+"\n"+txtUrl+"\n"+txtActive);
		document.myForm1.mode.value=mode;
		document.myForm1.songId.value=txtID;
		document.myForm1.lang.value=txtLang;
		document.myForm1.type.value=txtType;
		document.myForm1.url.value=txtUrl;
		document.myForm1.active.value=txtActive;
		
		setTimeout(document.myForm1.submit(),9000);

		//document.myForm1.submit();
		//url="saveSongs.php?mode="+mode+"&songId="+txtID+"&title="+txtTitle+"&movie="+txtMovie+"&music="+txtMusic+"&lang="+txtLang+"&type="+txtType+"&url="+txtUrl+"&active="+txtActive+"&singer1="+txtSinger1+"&singer2="+txtSinger2;
		//parent.frames[4].location.href=url;
		//window.alert("Record Saved Successfully!");
		cancelSongRec();
		//window.alert("Record Saved Successfully!");
	}else{
		window.alert("Warning:\n\n"+err+"\n");
	}			
	//window.alert(txtTitle+"\n"+txtMovie+"\n"+txtMusic+"\n"+txtLang+"\n"+txtType+"\n"+txtUrl+"\n"+txtActive);
}
function modySongRec(){
		document.myForm1.txtTitle.disabled=false;
		document.myForm1.txtMovie.disabled=false;
		document.myForm1.txtMusic.disabled=false;
		document.myForm1.txtSinger1.disabled=false;
		document.myForm1.txtSinger2.disabled=false;
		document.myForm1.lstLang.disabled=false;
		document.myForm1.lstType.disabled=false;
		document.myForm1.fileUrl.disabled=false;
		document.myForm1.chkActive.disabled=false;
}
function cancelSongRec(){
		document.myForm1.txtID.value="";
		document.myForm1.txtTitle.value="";
		document.myForm1.txtMovie.value="";
		document.myForm1.txtMusic.value="";
		document.myForm1.txtSinger1.value="";
		document.myForm1.txtSinger2.value="";
		document.myForm1.txtTitle.disabled=true;
		document.myForm1.txtMovie.disabled=true;
		document.myForm1.txtMusic.disabled=true;
		document.myForm1.txtSinger1.disabled=true;
		document.myForm1.txtSinger2.disabled=true;
		document.myForm1.lstLang.disabled=true;
		document.myForm1.lstType.disabled=true;
		document.myForm1.fileUrl.disabled=true;
		document.myForm1.chkActive.disabled=true;
}
function citySelect(){
	var str1, astr, country, province;
	str1=document.myForm1.lstCity.options[document.myForm1.lstCity.selectedIndex].value;
	astr=str1.split("|");
	country=astr[0];
	province=astr[1];
	document.myForm1.txtPro.value=province;
	document.myForm1.txtCountry.value=country;
}
function leftSelect(){
	var str, astr;
	if (document.myForm1.lstLeft.selectedIndex < 0){
		return;
	}
	str=document.myForm1.lstLeft.options[document.myForm1.lstLeft.selectedIndex].value;
	astr=str.split("|");
	//setupPlay(astr[1]);
	document.myForm1.btnRight.disabled=false;
	document.myForm1.btnLeft.disabled=true;
	document.myForm1.lstRight.selectedIndex = -1;
}
function rightSelect(){
	var str, astr;
	if (document.myForm1.lstRight.selectedIndex < 0){
		return;
	}
	str=document.myForm1.lstRight.options[document.myForm1.lstRight.selectedIndex].value;
	astr=str.split("|");
	//window.alert(str);
	setupPlay(astr[1]);
	document.myForm1.btnRight.disabled=true;
	document.myForm1.btnLeft.disabled=false;
	document.myForm1.lstLeft.selectedIndex = -1;
}
function moveRight(){
	var str, str1, astr;
	str=document.myForm1.lstLeft.options[document.myForm1.lstLeft.selectedIndex].value;
	str1=document.myForm1.lstLeft.options[document.myForm1.lstLeft.selectedIndex].text;
	if (chkDups(str1) == false){
		document.myForm1.lstRight.options[document.myForm1.lstRight.length] = new Option(str1, str);
		document.myForm1.lstLeft.selectedIndex = -1;
		//setupPlay("");
	}
}
function chkDups(val){
	var i, flg=false;
	for (i=0; i<document.myForm1.lstRight.length; i++){
		if (document.myForm1.lstRight.options[i].text == val){
			flg=true;
			break;
		}
	}
	return flg;
}
function moveLeft(){
	var str, str1, astr;
	document.myForm1.lstRight.remove(document.myForm1.lstRight.selectedIndex);
	document.myForm1.lstRight.selectedIndex = -1;
	document.myForm1.lstLeft.selectedIndex = -1;
	setupPlay("");
}
function setupPlay(song){
	//window.alert(song);
   var so = new SWFObject("playerMini.swf", "mymovie", "75", "30", "7", "#FFFFFF");
   so.addVariable("autoPlay", "yes");
   so.addVariable("soundPath", song);
   so.write("flashPlayer");
}
function setupPlay_1(idx){
	//window.alert(idx);
	var str, astr, i;
   	var so = new SWFObject("playerMini.swf", "mymovie", "75", "30", "7", "#FFFFFF");
   	so.addVariable("autoPlay", "yes");
	i=idx;
  //	while(i >= 0){
  		str=document.myForm1.lstRight.options[i].value;
		astr=str.split("|");

   		so.addVariable("soundPath", astr[1]);
   		so.write("flashPlayer");
		//if (i == (document.myForm1.lstRight.length - 1)){
		//	i = 0;
		//}else{
		//	++i;
		//}
   //}
}

function songPlay(){
	var idx;
	idx=document.myForm1.lstRight.selectedIndex;
	if (idx == -1){
		document.myForm1.lstRight.selectedIndex=0;
		setupPlay_1(0);
	}else{
		setupPlay_1(idx);
	}
}
function songStop(){
	setupPlay("");
}
function songPrev(){
	var idx;
	idx=document.myForm1.lstRight.selectedIndex;
	if (idx>0){
		document.myForm1.lstRight.options[idx].selected=false;
		document.myForm1.lstRight.selectedIndex=idx-1;
		setupPlay_1(idx-1);
	}
}
function songSkip(){
	var idx;
	idx=document.myForm1.lstRight.selectedIndex;
	if (idx < document.myForm1.lstRight.length-1){
		document.myForm1.lstRight.options[idx].selected=false;
		document.myForm1.lstRight.selectedIndex=idx+1;
		setupPlay_1(idx+1);
	}	
}

function addToCart(val1, val2){
	var obj;
	obj=addItem(val1, val2);
	document.myForm1.items.value=obj;
	window.alert("Item:"+val2.toUpperCase()+"\nhas been added to the rental list.\n\nPlease visit to Rental Reservation link to manage your rental items and \ncomplete your rental reservation");
	//obj.close();
}
function addItem(val1, val2){
	var regdWin, url, items;
	items=document.myForm1.items.value;
	if (items == ""){
		items=val1+"^"+val2+"^0^0";
	}else{
		items+="|"+val1+"^"+val2+"^0^0";
	}
	//url="addRent.php?itemId="+val1+"&itemName="+val2;
	//regdWin=window.open(url, "regdWin", "width=100, height=100");
	//return regdWin;
	return items;
}
function calc(val1, val2, val3){
	var items, arr1, arr2, str1, items1="", i;
	items=document.myForm1.items.value;
	arr1=items.split("|");
	arr2=arr1[val1].split("^");
	
	if (val3 == true){
		str1=arr2[0]+"^"+arr2[1]+"^"+val2+"^"+"1";
	}else{
		str1=arr2[0]+"^"+arr2[1]+"^"+val2+"^"+"0";
	}
	arr1[val1]=str1;
	
	for (i=0; i<arr1.length; i++){
		if (items1 != ""){
			items1=items1+"|"+arr1[i];
		}else{
			items1=arr1[i];
		}
	}
	document.myForm1.items.value=items1;
}
function rentSave(){
	var items, arr1, arr2, i, flg=0, err="", txtReqDate1, txtPeriod, user, obj, obj1, msg, userName;
	items=document.myForm1.items.value;
	arr1=items.split("|");
	
	for (i=0; i<arr1.length; i++){
		arr2=arr1[i].split("^");
		if (parseInt(arr2[2]) > 0 && parseInt(arr2[3]) == 1){
			flg=1;
			break;
		}
	}
	
	if (flg == 0){
		err=err+"No valid records selected\n";
	}
	
	txtReqDate1=document.myForm1.txtReqDate.value;
	txtPeriod=document.myForm1.txtPeriod.value;
	msg=document.myForm1.txtMsg.value;
	if (txtReqDate1 == ""){
		err=err+"Rental Request date is Blank\n";
	}else{
		if (isValidDate(txtReqDate1) == false){
			err+="Date of Rental is Invalid\n";
		}	
	}
	if (txtPeriod == 0 || txtPeriod == ""){
		err=err+"Rent Period is Invalid\n";
	}
	user=document.myForm1.userid1.value;
	userName=document.myForm1.userid.value;
	//window.alert("userid="+document.myForm1.userid.value + "\nuserid1="+ document.myForm1.userid1.value);	
	if (err == ""){
		obj=saveRentRec(user, txtReqDate1, txtPeriod, items, msg);
		str="MemberId:"+user+"   Date Required:"+txtReqDate1+"   Period Required:"+txtPeriod+"  items Required:"+items;
		obj1=sendEmail1(userName, user, "Rental Reservation", str);
		window.alert("Hi "+userName+"\n\nYour Rental Reservation has been saved successfully.\n\nWe will contact you soon for further information\n\nThank You - Admin, Tekno Media.\n");
		obj.close();
		obj1.close();		
	}else{
		window.alert("Warning:\n\n"+err+"\n");
	}
	
} 
function rentCancel(){

}
function saveRentRec(val1, val2, val3, val4, val5){
	var regdWin, url;
	url="saveRent.php?user="+val1+"&date="+val2+"&period="+val3+"&items="+val4+"&msg="+val5;
	regdWin=window.open(url, "regdWin", "width=100, height=100");
	return regdWin;
}
function isValidPhone(val){
	var flg1, flg2, flg;
	if (val.length != 10){
		return false;
	} 
	if (isNaN(val)){
		return false;
	}
	return true;
}
function isValidEmail(val){
	var i;
	if (val.indexOf("@", 0) <= 0 || val.indexOf(".", 0) <=0){
		return false;
	}else{
		i=val.indexOf("@", 0);
		if (val.indexOf("@", i+1) > 0){
			return false;
		}
	}
	i=i=val.indexOf("@", 0);
	if (val.indexOf(".", i+1) != val.lastIndexOf(".")){
		return false;
	}
	return true;
}
function isValidDate(val){
	var n1, n2, n3, dt, yy, mm, dd, mm1, mm2, dd2;
	n1=val.indexOf("/", 0);
	n2=val.indexOf("/", n1+1);
	//window.alert(n1+"-"+n2)
	//n3=val.indexOf("/", n2+1);
	if (!(n1<n2)){
		//window.alert(n1+"-"+n2);
		return false;
	}
	dt=new Date(val);
	yy=val.substr(0, n1);
	mm=val.substr(n1+1, n2-n1-1);
	dd=val.substr(n2+1, val.length-n2-1);
	//window.alert(yy+"-"+mm+"-"+dd);
	if (mm.length == 2 && mm.charAt(0) == '0'){
		mm=mm.charAt(1);
	}
	if (dd.length == 2 && dd.charAt(0) == '0'){
		dd=dd.charAt(1);
	}
	mm1=dt.getMonth()+1;
	mm2=parseInt(mm);
	dd2=parseInt(dd);
	//window.alert(dt.getYear()+"-"+parseInt(yy)+"|"+mm1+"-"+mm2+"-"+mm +"|"+dt.getDate()+"-"+dd2);
	if ((dt.getYear() != parseInt(yy) || mm1 != mm2 || dt.getDate() != dd2)){
		return false;
	}
	//window.alert(dt.getYear()+"-"+dt.getMonth()+"-"+dt.getDate());
	//if (!(dt.getYear() >= 2008 && dt.getMonth() >= 0 && dt.getDate() > 0)){
	//	return false;
	//}
	return true;
}
function loadMember(){
	var mem;
	mem=document.myForm1.lstType.options[document.myForm1.lstType.selectedIndex].value;
	document.myForm1.memType.value=mem;
	document.myForm1.submit();
}
function memMgr_setup(){
	var mem, i=0, upd;
	upd=parent.frames[1].document.myForm1.upd.value;
	//window.alert(upd);
	mem=document.myForm1.memType.value;
	for(i=0; i<document.myForm1.lstType.length; i++){
		if (mem == document.myForm1.lstType.options[i].value){
			document.myForm1.lstType.selectedIndex=i;
			break;	
		}
	}
}
function dispMemDetails(){
	var memVal, amem, city, i, status, upd, access;
	upd=parent.frames[1].document.myForm1.upd.value;
	access=parent.frames[1].document.myForm1.access.value;
	if (access == "superadmin"){
		document.myForm1.butDelete.disabled=false;
	}else{
		document.myForm1.butDelete.disabled=true;
	}	
	
	memVal=document.myForm1.lstMem.options[document.myForm1.lstMem.selectedIndex].value;
	amem=memVal.split("|");
	//window.alert(memVal);
	document.myForm1.txtID.value=amem[18];
	document.myForm1.txtFname.value=amem[0];
	document.myForm1.txtLname.value=amem[1];
	document.myForm1.txtHno.value=amem[2];
	document.myForm1.txtStreet.value=amem[3];
	city=amem[4];
	for (i=0; i<document.myForm1.lstCity.length; i++){
		if (document.myForm1.lstCity.options[i].text == city){
			document.myForm1.lstCity.selectedIndex=i;
			break;
		}
	}
	document.myForm1.txtPro.value=amem[5];
	document.myForm1.txtPcode.value=amem[6];
	document.myForm1.txtCountry.value=amem[7];
	document.myForm1.txtPhome.value=amem[8];
	document.myForm1.txtPmobile.value=amem[9];
	document.myForm1.txtPwork.value=amem[10];
	if (amem[11] == 1){
		document.myForm1.chkPvideo.checked=true;
	}else{
		document.myForm1.chkPvideo.checked=false;
	}
	if (amem[12] == 1){
		document.myForm1.chkRental.checked=true;
	}else{
		document.myForm1.chkRental.checked=false;
	}
	if (amem[13] == 1){
		document.myForm1.chkSale.checked=true;
	}else{
		document.myForm1.chkSale.checked=false;
	}
	if (amem[14] == 1){
		document.myForm1.chkSecSys.checked=true;
	}else{
		document.myForm1.chkSecSys.checked=false;
	}
	if (amem[16] == 1){
		document.myForm1.chkOther.checked=true;
		document.myForm1.othIntrst.value=amem[17];
	}else{
		document.myForm1.chkOther.checked=false;
		document.myForm1.othIntrst.value="";
	}
	
	document.myForm1.txtEmail.value=amem[15];
	document.myForm1.txtRemark.value=amem[19];
	
	status=amem[20];
	//window.alert(status);
	for (i=0; i<document.myForm1.lstStatus.length; i++){
		if (document.myForm1.lstStatus.options[i].value == status){
			document.myForm1.lstStatus.selectedIndex=i;
			break;
		}
	}	
	
	
	document.myForm1.txtFname.disabled=true;
	document.myForm1.txtLname.disabled=true;
	document.myForm1.txtHno.disabled=true;
	document.myForm1.txtStreet.disabled=true;
	document.myForm1.lstCity.disabled=true;
	document.myForm1.txtPro.disabled=true;
	document.myForm1.txtPcode.disabled=true;
	document.myForm1.txtCountry.disabled=true;
	document.myForm1.txtPhome.disabled=true;
	document.myForm1.txtPmobile.disabled=true;
	document.myForm1.txtPwork.disabled=true;
	document.myForm1.chkPvideo.disabled=true;
	document.myForm1.chkRental.disabled=true;
	document.myForm1.chkSale.disabled=true;
	document.myForm1.chkSecSys.disabled=true;
	document.myForm1.chkOther.disabled=true;
	document.myForm1.othIntrst.disabled=true;
	document.myForm1.lstStatus.disabled=true;
	document.myForm1.txtRemark.disabled=true;
	document.myForm1.btnSave.disabled=true;
	document.myForm1.txtEmail.disabled=true;
	if (upd == "Y"){
		document.myForm1.btnModify.disabled=false;
		document.myForm1.btnSave.disabled=true;
		document.myForm1.btnCancel.disabled=false;
	}else{
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=true;
		document.myForm1.btnCancel.disabled=true;
	}
}
function memberModify(){
	var upd;
	upd=document.myForm1.upd.value;
	document.myForm1.txtFname.disabled=false;
	document.myForm1.txtLname.disabled=false;
	document.myForm1.txtHno.disabled=false;
	document.myForm1.txtStreet.disabled=false;
	document.myForm1.lstCity.disabled=false;
	document.myForm1.txtPro.disabled=false;
	document.myForm1.txtPcode.disabled=false;
	document.myForm1.txtCountry.disabled=false;
	document.myForm1.txtPhome.disabled=false;
	document.myForm1.txtPmobile.disabled=false;
	document.myForm1.txtPwork.disabled=false;
	document.myForm1.chkPvideo.disabled=false;
	document.myForm1.chkRental.disabled=false;
	document.myForm1.chkSale.disabled=false;
	document.myForm1.chkSecSys.disabled=false;
	document.myForm1.chkOther.disabled=false;
	document.myForm1.othIntrst.disabled=false;
	document.myForm1.lstStatus.disabled=false;
	document.myForm1.txtRemark.disabled=false;
	document.myForm1.btnSave.disabled=false;
	document.myForm1.txtEmail.disabled=false;
	
	document.myForm1.btnModify.disabled=true;
	document.myForm1.btnSave.disabled=false;
	document.myForm1.btnCancel.disabled=false;
}
function memberSave(){
	document.myForm1.mode.value="SAVE";
	document.myForm1.txtCity.value=document.myForm1.lstCity.options[document.myForm1.lstCity.selectedIndex].text;
	document.myForm1.txtStatus.value=document.myForm1.lstStatus.options[document.myForm1.lstStatus.selectedIndex].value;
	if (document.myForm1.chkPvideo.checked){
		document.myForm1.chkV.value=1;
	}else{
		document.myForm1.chkV.value=0;
	}
	if (document.myForm1.chkRental.checked){
		document.myForm1.chkR.value=1;
	}else{
		document.myForm1.chkR.value=0;
	}
	if (document.myForm1.chkSale.checked){
		document.myForm1.chkS.value=1;
	}else{
		document.myForm1.chkS.value=0;
	}
	if (document.myForm1.chkSecSys.checked){
		document.myForm1.chkSS.value=1;
	}else{
		document.myForm1.chkSS.value=0;
	}
	if (document.myForm1.chkOther.checked){
		document.myForm1.chkO.value=1;
	}else{
		document.myForm1.chkO.value=0;
	}				
	document.myForm1.submit();
}
function memberCancel(){
	if (document.myForm1.lstMem.selectedIndex >= 0){
		dispMemDetails();
	}
}
function photoDesignImgUpload(){
	var winObj, userid;
	userid=document.myForm1.userid1.value;
	winObj=window.open("extend_photo_upload.php?userid="+userid, "uploadWin", "width=350, height=500, status=0, resizable=0, toolbar=0, menubar=0");
}
function photoDesignImgMsg(){
	window.alert("Warning!\n\nThis option is available for members only. \n\nIf you are a member, please logon and try again.\n\n");
}
function checkImgFiles(){
	var f1, f2, f3, f4, f5;
	f1=document.myForm1.imgFile1.value;
	f2=document.myForm1.imgFile2.value;
	f3=document.myForm1.imgFile3.value;
	f4=document.myForm1.imgFile4.value;
	f5=document.myForm1.imgFile5.value;
	if (f1 != "" || f2 != "" || f3 != "" || f4 != ""  || f5 != ""){
		document.myForm1.submit();
	}else{
		window.alert("Warning!\n\nPlease select at least one image to upload\n\n");
	}
}
function checkResumeFile(){
	var f11;
	f11=document.myForm1.Resume.value;
	if (f11 != ""){
		window.alert("Hi,\n\nThank you for the interest you have shown in Tekno Media.Our resourcing department will be reviewing your application and if your qualifications correspond to our requirements, a member of our team will contact you. Please note that only applicants selected for an interview will be contacted.\n\nWe wish you success in your career goals.\n\nTekno Media Team.\n\n");
		document.myForm1.submit();
	}else{
		window.alert("Warning!\n\nPlease select a file to upload\n\n");
	}
}
function savesonglist(){
	var songList="", i, sng, arr, obj;
	var userid, jobId;
	if (document.myForm1.lstJob.length == 0){
		window.alert("Warning!\n\nNo Active Video Jobs available!!\n\n");
		return;
	}
	if (document.myForm1.lstRight.length == 0){
		window.alert("Warning!\n\nNo songs selected!!\n\n");
	}else{
		for(i=0; i<document.myForm1.lstRight.length; i++){
			if (songList != ""){
				songList+="|";
			}
			sng=document.myForm1.lstRight.options[i].value;
			arr=sng.split("|");
			songList+=arr[0];
		}
		//window.alert(songList);
		userid=document.myForm1.userid1.value;
		jobId=document.myForm1.lstJob.options[document.myForm1.lstJob.selectedIndex].text;
		obj=saveSongList(userid, jobId, songList);
		window.alert("Song List saved successfully!");
		obj.close();
	}
}
function clrsonglist(){
	//window.alert("clear");
	var i=document.myForm1.lstRight.length;
	while(i>=0){
		document.myForm1.lstRight.remove(i);
		--i;
	}
}
function saveSongList(userId, jobId, sngList){
	var regdWin, url;
	url="saveSongRec.php?userId="+userId+"&jobId="+jobId+"&sngList="+sngList;
	regdWin=window.open(url, "regdWin", "width=100, height=100");
	return regdWin;
}
function signupUpdate(){
	var errMsg="", obj, obj1, obj2, msgBody, uid;
	var fName, lName, hNo, st, city, pro, pcode, country, hPh, mPh, wPh, email, chkVideo, chkRental, chkSale, chkSecSys, chkOther, other;
	fName=document.myForm1.txtFname.value;
	lName=document.myForm1.txtLname.value;
	hNo=document.myForm1.txtHno.value;
	st=document.myForm1.txtStreet.value;
	city=document.myForm1.lstCity.options[document.myForm1.lstCity.selectedIndex].text;
	pro=document.myForm1.txtPro.value;
	pcode=document.myForm1.txtPcode.value;
	country=document.myForm1.txtCountry.value;
	hPh=document.myForm1.txtPhome.value;
	mPh=document.myForm1.txtPmobile.value;
	wPh=document.myForm1.txtPwork.value;
	email=document.myForm1.txtEmail.value;
	chkVideo=document.myForm1.chkPvideo.checked;
	chkRental=document.myForm1.chkRental.checked;
	chkSale=document.myForm1.chkSale.checked;
	chkSecSys=document.myForm1.chkSecSys.checked;
	chkOther=document.myForm1.chkOther.checked;
	other=document.myForm1.txtOther.value;
	
	uid=document.myForm1.userid1.value;
	
	if (fName == ""){
		errMsg+="First Name is Blank\n";
	}
	if (lName == ""){
		errMsg+="Last Name is Blank\n";
	}
	if (hNo == ""){
		errMsg+="House/Apt Number is Blank\n";
	}
	if (st == ""){
		errMsg+="Street Name is Blank\n";
	}
	if (pcode == ""){
		errMsg+="Postal Code is Blank\n";
	}
	if (hPh == "" && mPh == "" && wPh == ""){
		errMsg+="Phone Numbers are Blank\n";
	}
	if (hPh != ""){
		if (isValidPhone(hPh) == false){
			errMsg+="Home Phone number is Invalid\n";
		}
	}
	if (mPh != ""){
		if (isValidPhone(mPh) == false){
			errMsg+="Mobile Phone number is Invalid\n";
		}
	}
	if (wPh != ""){
		if (isValidPhone(wPh) == false){
			errMsg+="Work Phone number is Invalid\n";
		}
	}
	if (email == ""){
		errMsg+="Email is Blank\n";
	}else{
		if (isValidEmail(email) == false){
			errMsg+="Email is Invalid\n";
		}
	}
		
	if (chkVideo == false && chkRental == false && chkSale == false && chkSecSys == false && chkOther == false){
		errMsg+="Non of your Interested Items Selected\n";
	}
	if (chkOther == true && other==""){
		errMsg+="Other Interested Item is Blank\n";
	}
	if (errMsg != ""){
		window.alert("Warning!\n\n"+errMsg);
	}else{
		obj=userRegisterUpd(fName, lName, hNo, st, city, pro, pcode, country, hPh, mPh, wPh, email, chkVideo, chkRental, chkSale, chkSecSys, chkOther, other, uid);
		//signupClr();
		//obj.close();
		//displaying message to the user
		//message to admin
		
		window.alert("Hi "+ fName + "!\n\nYour Profile has been saved successfully\n\n");
		//msgBody="Name:"+fName+" - "+lName+" **** Address:"+ hNo + " - " + st +" - " + city;
		//window.alert(testEmail);
		//obj1=sendEmail1(fName, email, "Teknomedia OnLine - Registration Confirmation", msgBody);
		//window.alert("Hi "+ fName + "!\n\n" + "Thank You for Signing up with us\n\nYour regitration will be verified and your login information will be sent soon\n\n" );
		//window.alert("Hi "+ fName + "!\n\n" + "Thank you for choosing Tekno Media!\n\nYour registration is successful. You will receive an official email from Tekno Media within the next 24 hrs with your confirmed username and password. After you have received your credentials by email you may login to the site.\n\nWe thank you for your patience.\n\nAdmin, Teknomedia Online");
		//message to new user
		//msgBody="Dear "+fName+"**** Thank you for signing up with us. our regitration will be verified and your login information will be sent soon - Admin, Teknomedia On Line ****";
		//obj2=sendEmail(email, "Teknomedia OnLine - Registration Confirmation", msgBody);
		obj.close();
		//obj1.close();
		//obj2.close();
	}
}
function userRegisterUpd(fName, lName, hNo, st, city, pro, pcode, country, hPh, mPh, wPh, email, chkVideo, chkRental, chkSale, chkSecSys, chkOther, other, uid){

	var url="", regdWin;
	
	url="regdPageUpd.php?uid="+uid+"&fName="+fName+"&lName="+lName+"&hNo="+hNo+"&st="+st+"&city="+city+"&pro="+pro+"&pcode="+pcode+"&country="+country+"&hPh="+hPh+"&mPh="+mPh+"&wPh="+wPh+"&email="+email;
	
	if (chkVideo == true){
		url+="&chkVideo=1";
	}else{
		url+="&chkVideo=0";
	}
	if (chkRental == true){
		url+="&chkRental=1";
	}else{
		url+="&chkRental=0";
	}
	if (chkSale == true){
		url+="&chkSale=1";
	}else{
		url+="&chkSale=0";
	}
	if (chkSecSys == true ){
		url+="&chkSecSys=1";
	}else{
		url+="&chkSecSys=0";
	}
	if (chkOther == true){
		url+="&chkOther=1";
	}else{
		url+="&chkOther=0";
	}
	url+="&other="+other;
	
	//window.alert(url);
	regdWin=window.open(url, "regdWin", "width=100, height=100");
	return regdWin;
}
function signupReset(){
	loadPage(6, 1);
	document.getElementById('othIntrst').style.display="none";	
}
function passUpdate(){
	var oldPwd, newPwd, errMsg="", curPwd, memberid;
	oldPwd=document.myForm1.txtPwdOld.value;
	newPwd=document.myForm1.txtPwdNew.value;
	curPwd=document.myForm1.oldPwd.value;
	memberid=document.myForm1.userid1.value;
	
	if (oldPwd == ""){
		errMsg+="Old Password is Blank\n";
	}
	if (oldPwd == ""){
		errMsg+="New Password is Blank\n";
	}
	if (errMsg == ""){
		if (oldPwd != curPwd){
			errMsg+="Old Password does not match\n";
		}
		if (oldPwd == newPwd){
			errMsg+="Old Password can not be same as New Password\n";
		}
	}
	if (errMsg != ""){
		window.alert("Warning\n\n"+errMsg);
	}else{
		obj=pwdChange(memberid, newPwd);
		window.alert("Your Password has been changed Successfully\n");
		obj.close();
	}	
}
function passReset(){
	document.myForm1.txtPwdOld.value="";
	document.myForm1.txtPwdNew.value="";
}
function pwdChange(uid, newPwd){
	var url="", regdWin;
	url="chngPwd.php?uid="+uid+"&newPwd="+newPwd;
	regdWin=window.open(url, "regdWin", "width=100, height=100");
	return regdWin;
}
function loadNews(){
	var idx, val, arr, upd, access;
	upd=document.myForm1.upd.value;
	idx=document.myForm1.lstDt.selectedIndex;
	access=parent.frames[1].document.myForm1.access.value;
	if (access == "superadmin" && idx>0){
		document.myForm1.butDelete.disabled=false;
	}else{
		document.myForm1.butDelete.disabled=true;
	}	
	if (idx == 0){
		if (upd != "Y"){
			window.alert("Sorry!, You have no permission to add new items!!");
			return;
		}
		document.myForm1.txtDt.value = "<New News>";
		document.myForm1.txtNews.value="";
		document.myForm1.radYN[0].checked = true;
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=false;
		document.myForm1.btnCancel.disabled=false;
		document.myForm1.txtNews.disabled=false;
		document.myForm1.radYN[0].disabled=false;
		document.myForm1.radYN[1].disabled=false;			
	}else{
		document.myForm1.txtDt.value=document.myForm1.lstDt.options[idx].text;
		val=document.myForm1.lstDt.options[idx].value;
		arr=val.split("|");
		document.myForm1.txtNews.value=arr[0];
		if (arr[1]=="Y"){
			document.myForm1.radYN[0].checked = true;
		}else{
			document.myForm1.radYN[1].checked = true;
		}
		document.myForm1.txtHead.value=arr[2];
		if (upd == "Y"){
			document.myForm1.btnModify.disabled=false;
			document.myForm1.btnSave.disabled=true;
		}else{
			document.myForm1.btnModify.disabled=true;
			document.myForm1.btnSave.disabled=true;
		}
		document.myForm1.btnCancel.disabled=true;
		document.myForm1.txtNews.disabled=true;
		document.myForm1.txtHead.disabled=true;	
		document.myForm1.radYN[0].disabled=true;
		document.myForm1.radYN[1].disabled=true;			
	}
}
function cancelNewsRec(){
	var idx;
	idx=document.myForm1.lstDt.selectedIndex;
	if (idx == 0){
		document.myForm1.txtDt.value = "----- New News -----";
		document.myForm1.txtNews.value="";
		document.myForm1.txtHead.value="";
		document.myForm1.radYN[0].checked = true;
	}else{
		loadNews();
	}
}
function modyNewsRec(){
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=false;
		document.myForm1.btnCancel.disabled=false;
		document.myForm1.txtNews.disabled=false;
		document.myForm1.txtHead.disabled=false;
		document.myForm1.radYN[0].disabled=false;
		document.myForm1.radYN[1].disabled=false;		
}
function saveNewsRec(){
	var news, mode, dt, active, err="", newshead;
	dt=document.myForm1.txtDt.value;
	newshead=document.myForm1.txtHead.value;
	news=document.myForm1.txtNews.value;
	if (newshead == ""){
		err+="News Head is Empty\n";
	}
	if (news == ""){
		err+="News is Empty\n";
	}
	if (err != ""){
		window.alert("Warning!\n\n"+err+"\n");
	}else{
		if (dt == "<New News>"){
			mode="NEW";
		}else{
			mode="UPD";
		}
		if (document.myForm1.radYN[0].checked){
			active="Y";
		}else{
			active="N";
		}
		url="saveNews.php?dt="+dt+"&mode="+mode+"&news="+news+"&active="+active+"&newshead="+newshead;
		parent.frames[4].location.href=url;
		window.alert("Record Saved Successfully!");
		parent.frames[2].location.href="newslink.php";		
	}
}
function dispVideoDetails(){
	var val, arr, i, status, type, upd, access, tm, arrtm, tmf, tmt, idx, mode;
	access=parent.frames[1].document.myForm1.access.value;
	
	idx=document.myForm1.lstVideo.selectedIndex;
	if (access == "superadmin" && idx>0){
		document.myForm1.butDelete.disabled=false;
	}else{
		document.myForm1.butDelete.disabled=true;
	}
	upd=parent.frames[1].document.myForm1.upd.value;
	
	if (idx == 0){
		mode="NEW";
		document.myForm1.txtReqId.value="<New>";
		document.myForm1.txtName.value="";
		document.myForm1.txtMemId.value="";
		document.myForm1.txtDate.value="";
		document.myForm1.txtVanue.value="";
		document.myForm1.txtVenueAddr.value="";
		document.myForm1.lstType.selectedIndex=1;
		document.myForm1.txtOth.value="";
		document.myForm1.txtDob.value="";
		document.myForm1.timefrom.selectedIndex=0;
		document.myForm1.timeto.selectedIndex=0;
		document.myForm1.txtVenuePhone.value="";
		document.myForm1.txtRemark.value="";
		document.myForm1.txtMsg.value="";
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=false;
	}else{
		mode="VIEW";
		val=document.myForm1.lstVideo.options[document.myForm1.lstVideo.selectedIndex].value;
		//window.alert(val);
		arr=val.split("|");
		document.myForm1.txtReqId.value=arr[0];
		document.myForm1.txtName.value=arr[1];
		document.myForm1.txtMemId.value=arr[2];
		document.myForm1.txtDate.value=arr[3];
		document.myForm1.txtVanue.value=arr[4];
		document.myForm1.txtVenueAddr.value=arr[5];
		for (i=0; i<document.myForm1.lstType.length; i++){
			if (document.myForm1.lstType.options[i].text == arr[6]){
				document.myForm1.lstType.selectedIndex=i;
				break;
			}
		}
		document.myForm1.txtOth.value=arr[7];
		if (arr[6] == "Birthday Ceremony"){
			document.myForm1.txtDob.value=arr[13];
		}else{
			document.myForm1.txtDob.value="";
		}	
		if (arr[7] != ""){
			type=arr[7];
		}else{
			type=arr[6];
		}
		tm=arr[14];
		if (tm != ""){
			arrtm=tm.split(" ");
			tmf=arrtm[1].substring(0, 5);
		}else{
			tmf="";
		}
		tm=arr[15];
		if (tm != ""){
			arrtm=tm.split(" ");
			tmt=arrtm[1].substring(0, 5);
		}else{
			tmt="";
		}
		for (i=0; i<document.myForm1.timefrom.length; i++){
			if (document.myForm1.timefrom.options[i].value == tmf){
				document.myForm1.timefrom.selectedIndex=i;
				break;
			}
		}
		for (i=0; i<document.myForm1.timeto.length; i++){
			if (document.myForm1.timeto.options[i].value == tmt){
				document.myForm1.timeto.selectedIndex=i;
				break;
			}
		}	
			
		document.myForm1.txtVenuePhone.value=arr[8];
		document.myForm1.txtRemark.value=arr[9];
		document.myForm1.txtMsg.value=arr[10];
		status=arr[12];
		document.myForm1.txtJobId.value=arr[11];
		for (i=0; i<document.myForm1.lstStatus.length; i++){
			if (document.myForm1.lstStatus.options[i].value == status){
				document.myForm1.lstStatus.selectedIndex=i;
				break;
			}
		}
		document.myForm1.lstStatus.disabled=true;
		document.myForm1.txtRemark.disabled=true;
		if (upd == "Y"){
			document.myForm1.btnModify.disabled=false;
			document.myForm1.btnSave.disabled=true;
		}else{
			document.myForm1.btnModify.disabled=true;
			document.myForm1.btnSave.disabled=true;
		}
		
		//document.myForm1.mode.value="SAVE";
		//document.myForm1.status.value=status;
		document.myForm1.remark.value=arr[9];
		document.myForm1.reqid.value=arr[0];
		document.myForm1.memberid.value=arr[2];
		document.myForm1.jobtype.value=type;
		document.myForm1.resdate.value=arr[3];
	}
	document.myForm1.mode.value=mode;
	//document.myForm1.submit();
}
function modyVideoRsvRec(){
	document.myForm1.mode.value="UPD";
	document.myForm1.lstStatus.disabled=false;
	document.myForm1.txtRemark.disabled=false;
	document.myForm1.btnModify.disabled=true;
	document.myForm1.btnSave.disabled=false;
}
function saveVideoRsvRec(){
	var mode="", err="";
	mode=document.myForm1.mode.value;
	if (mode == "NEW"){
		document.myForm1.memberid.value=document.myForm1.txtMemId.value;
		document.myForm1.jobtype.value=document.myForm1.lstType.options[document.myForm1.lstType.selectedIndex].text;
		document.myForm1.resdate.value=document.myForm1.txtDate.value;
		document.myForm1.dt_birth.value=document.myForm1.txtDob.value;
		document.myForm1.time_from.value=document.myForm1.timefrom.options[document.myForm1.timefrom.selectedIndex].value;
		document.myForm1.time_to.value=document.myForm1.timeto.options[document.myForm1.timeto.selectedIndex].value;
		document.myForm1.venue.value=document.myForm1.txtVanue.value;
		document.myForm1.venue_addr.value=document.myForm1.txtVenueAddr.value;
		document.myForm1.venue_phone.value=document.myForm1.txtVenuePhone.value;
		document.myForm1.msg.value=document.myForm1.txtMsg.value;
		document.myForm1.other_type.value=document.myForm1.txtOth.value;
		
		if (document.myForm1.memberid.value == ""){
			err+="MemberId is blank\n";
		}
		if (document.myForm1.resdate.value == ""){
			err+="Reservation Date is blank\n";
		}else{
			if (isValidDate(document.myForm1.resdate.value) == false){
				err+="Invalid Reservation Date\n";
			}
		}
		if (document.myForm1.jobtype.value == "Birthday Ceremony"){
			if (document.myForm1.dt_birth.value == ""){
				err+="Birth Date is blank\n";
			}else{
				if (isValidDate(document.myForm1.dt_birth.value) == false){
					err+="Invalid Birth Date\n";
				}
			}
		}
		if (document.myForm1.lstType.selectedIndex == 2){
			if (document.myForm1.other_type.value == ""){
				err+="Type of Ceremony is blank\n";
			}
		}
		if (document.myForm1.timefrom.selectedIndex >= document.myForm1.timeto.selectedIndex){
			err+="Times are not in order\n";
		}
		if (document.myForm1.venue.value == ""){
			err+="Venue is Blank\n";
		}
		if (document.myForm1.venue_addr.value == ""){
			err+="Venue Address is Blank\n";
		}
		if (document.myForm1.venue_phone.value == ""){
			err+="Venue Phone is Blank\n";
		}else{
			if (isValidPhone(document.myForm1.venue_phone.value) == false){
				err+="Phone Number is InValid\n";
			}
		}
		if (err != ""){
			window.alert("Warning\n\n"+err+"\n\n");
			return;
		}else{
		
		}
	}
	if (mode == "UPD"){
		//document.myForm1.mode.value="SAVE";
		document.myForm1.status.value=document.myForm1.lstStatus.options[document.myForm1.lstStatus.selectedIndex].value;
		document.myForm1.remark.value=document.myForm1.txtRemark.value;
	}
	document.myForm1.submit();
}
function dispRentDetails(){
	var val, arr, i, status, type, upd, access;
	access=parent.frames[1].document.myForm1.access.value;
	if (access == "superadmin"){
		document.myForm1.butDelete.disabled=false;
	}else{
		document.myForm1.butDelete.disabled=true;
	}	
	upd=parent.frames[1].document.myForm1.upd.value;
	val=document.myForm1.lstRent.options[document.myForm1.lstRent.selectedIndex].value;
	//window.alert(val);
	arr=val.split("|");
	document.myForm1.txtReqId.value=arr[0];
	document.myForm1.txtName.value=arr[1];
	document.myForm1.txtMemId.value=arr[2];
	document.myForm1.txtDate.value=arr[3];
	document.myForm1.txtPeriod.value=arr[4];
	document.myForm1.txtRemark.value=arr[5];
	document.myForm1.txtMsg.value=arr[6];
	status=arr[8];
	document.myForm1.txtJobId.value=arr[7];
	for (i=0; i<document.myForm1.lstStatus.length; i++){
		if (document.myForm1.lstStatus.options[i].value == status){
			document.myForm1.lstStatus.selectedIndex=i;
			break;
		}
	}
	document.myForm1.lstStatus.disabled=true;
	document.myForm1.txtRemark.disabled=true;
	if (upd == "Y"){
		document.myForm1.btnModify.disabled=false;
		document.myForm1.btnSave.disabled=true;
	}else{
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=true;
	}
	
	//document.myForm1.mode.value="SAVE";
	//document.myForm1.status.value=status;
	document.myForm1.remark.value=arr[5];
	document.myForm1.reqid.value=arr[0];
	document.myForm1.memberid.value=arr[2];
	document.myForm1.jobtype.value="";
	document.myForm1.resdate.value=arr[3];
	
	//document.myForm1.submit();
}
function saveRentRsvRec(){
	document.myForm1.mode.value="SAVE";
	document.myForm1.status.value=document.myForm1.lstStatus.options[document.myForm1.lstStatus.selectedIndex].value;
	document.myForm1.remark.value=document.myForm1.txtRemark.value;
	document.myForm1.submit();
}
function dispJobDetails(){
	var val, arr, i, v1, v2, v3, v4, v5, av1, av2, av3, av4, av5, a1, a2, a3, a4, a5, upd, access;
	upd=parent.parent.frames[1].document.myForm1.upd.value;
	access=parent.parent.frames[1].document.myForm1.access.value;
	if (access == "superadmin"){
		document.myForm1.butDelete.disabled=false;
	}else{
		document.myForm1.butDelete.disabled=true;
	}	
	
	val=document.myForm1.lstJob.options[document.myForm1.lstJob.selectedIndex].value;
	//window.alert(val);
	arr=val.split("|");
	document.myForm1.txtReqId.value=arr[0];
	document.myForm1.txtName.value=arr[1];
	document.myForm1.txtMemId.value=arr[2];
	document.myForm1.txtResvDt.value=arr[3];
	document.myForm1.txtJobType.value=arr[4];
	if (arr[5] == "Y"){
		document.myForm1.chkJobAccept.checked=true;
		//document.myForm1.lstProgress.disabled=false;
	}else{
		document.myForm1.chkJobAccept.checked=false;
		//document.myForm1.lstProgress.disabled=true;
	}
	document.myForm1.txtAcceptBy.value=arr[6];
	document.myForm1.txtAcceptDt.value=arr[7];
	document.myForm1.txtJobCat.value=arr[8];
	document.myForm1.txtRemark.value=arr[9];
	for(i=0; i<document.myForm1.lstProgress.length; i++){
		if (document.myForm1.lstProgress.options[i].value == arr[10]){
			document.myForm1.lstProgress.selectedIndex=i;
			break;
		}
	}
	document.myForm1.txtJobId.value=arr[11];
	switch(arr[12]){
		case "A":
			document.myForm1.txtJobStatus.value="Active";
			break;
		case "C":
			document.myForm1.txtJobStatus.value="Completed";
			break;
		case "D":
			document.myForm1.txtJobStatus.value="DeActive";
			break;
	}
	for(i=0; i< document.myForm1.lstAss1.length; i++){
		v1=document.myForm1.lstAss1.options[i].value;
		av1=v1.split("|");
		a1=av1[0];
		if (a1 == arr[13]){
			document.myForm1.lstAss1.selectedIndex = i;
			document.myForm1.e1.value=av1[1];
			document.myForm1.n1.value=document.myForm1.lstAss1.options[i].text;
			break;	
		}
	}
	for(i=0; i< document.myForm1.lstAss2.length; i++){
		v2=document.myForm1.lstAss2.options[i].value;
		av2=v2.split("|");
		a2=av2[0];
		if (a2 == arr[14]){
			document.myForm1.lstAss2.selectedIndex = i;
			document.myForm1.e2.value=av2[1];
			document.myForm1.n2.value=document.myForm1.lstAss2.options[i].text;
			break;	
		}
	}
	for(i=0; i< document.myForm1.lstAss3.length; i++){
		v3=document.myForm1.lstAss3.options[i].value;
		av3=v3.split("|");
		a3=av3[0];
		if (a3 == arr[15]){
			document.myForm1.lstAss3.selectedIndex = i;
			document.myForm1.e3.value=av3[1];
			document.myForm1.n3.value=document.myForm1.lstAss3.options[i].text;
			break;	
		}
	}
	for(i=0; i< document.myForm1.lstAss4.length; i++){
		v4=document.myForm1.lstAss4.options[i].value;
		av4=v4.split("|");
		a4=av4[0];
		if (a4 == arr[16]){
			document.myForm1.lstAss4.selectedIndex = i;
			document.myForm1.e4.value=av4[1];
			document.myForm1.n4.value=document.myForm1.lstAss4.options[i].text;
			break;	
		}
	}
	for(i=0; i< document.myForm1.lstAss5.length; i++){
		v5=document.myForm1.lstAss5.options[i].value;
		av5=v5.split("|");
		a5=av5[0];
		if (a5 == arr[17]){
			document.myForm1.lstAss5.selectedIndex = i;
			document.myForm1.e5.value=av5[1];
			document.myForm1.n5.value=document.myForm1.lstAss5.options[i].text;
			break;	
		}
	}				
	
	//disabled
	document.myForm1.lstAss1.disabled=true;
	document.myForm1.lstAss2.disabled=true;
	document.myForm1.lstAss3.disabled=true;
	document.myForm1.lstAss4.disabled=true;
	document.myForm1.lstAss5.disabled=true;
	document.myForm1.txtAcceptBy.disabled=true;
	document.myForm1.txtAcceptDt.disabled=true;
	document.myForm1.txtRemark.disabled=true;
	document.myForm1.lstProgress.disabled=true;
	document.myForm1.chkJobAccept.disabled=true;
	if (upd == "Y"){
		document.myForm1.btnModify.disabled=false;
		document.myForm1.btnSave.disabled=true;
	}else{
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=true;
	}	
}
function modyJob(){
	document.myForm1.lstAss1.disabled=false;
	document.myForm1.lstAss2.disabled=false;
	document.myForm1.lstAss3.disabled=false;
	document.myForm1.lstAss4.disabled=false;
	document.myForm1.lstAss5.disabled=false;
	document.myForm1.txtAcceptBy.disabled=false;
	document.myForm1.txtAcceptDt.disabled=false;
	document.myForm1.txtRemark.disabled=false;
	document.myForm1.lstProgress.disabled=false;
	document.myForm1.chkJobAccept.disabled=false;
	document.myForm1.btnModify.disabled=true;
	document.myForm1.btnSave.disabled=false;
}
function jobChkClick(){
	if (document.myForm1.chkJobAccept.checked){
		document.myForm1.txtAcceptBy.disabled=false;
		document.myForm1.txtAcceptDt.disabled=false;
		document.myForm1.chkAcpt.value=1;
	}else{
		document.myForm1.txtAcceptBy.value="";
		document.myForm1.txtAcceptDt.value="";
		document.myForm1.txtAcceptBy.disabled=true;
		document.myForm1.txtAcceptDt.disabled=true;
		document.myForm1.chkAcpt.value=0;
	}
}
function saveJob(){
	var jacpt, a1, a2, a3, a4, a5, acptby, acptdt, prg, rmk, vPrg, v1, v2, v3, v4, v5, av1, av2, av3, av4, av5;
	jacpt=(document.myForm1.chkJobAccept.checked)?1:0;
	if (document.myForm1.lstAss1.selectedIndex != 0){
		v1=document.myForm1.lstAss1.options[document.myForm1.lstAss1.selectedIndex].value;
		av1=v1.split("|");
		a1=av1[0];
	}else{
		a1="";
	}
	if (document.myForm1.lstAss2.selectedIndex != 0){
		v2=document.myForm1.lstAss2.options[document.myForm1.lstAss2.selectedIndex].value;
		av2=v2.split("|");
		a2=av2[0];
	}else{
		a2="";
	}
	if (document.myForm1.lstAss3.selectedIndex != 0){
		v3=document.myForm1.lstAss3.options[document.myForm1.lstAss3.selectedIndex].value;
		av3=v3.split("|");
		a3=av3[0];
	}else{
		a3="";
	}
	if (document.myForm1.lstAss4.selectedIndex != 0){
		v4=document.myForm1.lstAss4.options[document.myForm1.lstAss4.selectedIndex].value;
		av4=v4.split("|");
		a4=av4[0];
	}else{
		a4="";
	}	
	if (document.myForm1.lstAss5.selectedIndex != 0){
		v5=document.myForm1.lstAss5.options[document.myForm1.lstAss5.selectedIndex].value;
		av5=v5.split("|");
		a5=av5[0];
	}else{
		a5="";
	}				
	acptby=document.myForm1.txtAcceptBy.value;
	acptdt=document.myForm1.txtAcceptDt.value;
	rmk=document.myForm1.txtRemark.value;
	prg=document.myForm1.lstProgress.options[document.myForm1.lstProgress.selectedIndex].text;
	vPrg=document.myForm1.lstProgress.options[document.myForm1.lstProgress.selectedIndex].value;
	//window.alert(jacpt+"|"+a1+"|"+a2+"|"+a3+"|"+a4+"|"+a5+"|"+acptby+"|"+acptdt+"|"+prg+"|"+rmk);
	
	document.myForm1.a1.value=a1;
	document.myForm1.a2.value=a2;
	document.myForm1.a3.value=a3;
	document.myForm1.a4.value=a4;
	document.myForm1.a5.value=a5;
	document.myForm1.by.value=acptby;
	document.myForm1.dt.value=acptdt;
	document.myForm1.rm.value=rmk;
	
	document.myForm1.lstAss1.disabled=true;
	document.myForm1.lstAss2.disabled=true;
	document.myForm1.lstAss3.disabled=true;
	document.myForm1.lstAss4.disabled=true;
	document.myForm1.lstAss5.disabled=true;
	document.myForm1.txtAcceptBy.disabled=true;
	document.myForm1.txtAcceptDt.disabled=true;
	document.myForm1.txtRemark.disabled=true;
	document.myForm1.lstProgress.disabled=true;
	document.myForm1.chkJobAccept.disabled=true;
	document.myForm1.btnModify.disabled=false;
	document.myForm1.btnSave.disabled=true;
	
	document.myForm1.vPrg.value=vPrg;
	document.myForm1.mode.value="SAVE";
	
	document.myForm1.submit();	
}
function cancelJob(){

}
function check(val){
	switch(val){
		case 1:
			if (document.myForm1.chk12.checked){
				document.myForm1.chk11.checked=true;
			}
			break;
		case 2:
			if (document.myForm1.chk22.checked){
				document.myForm1.chk21.checked=true;
			}
			break;
		case 3:
			if (document.myForm1.chk32.checked){
				document.myForm1.chk31.checked=true;
			}
			break;
		case 4:
			if (document.myForm1.chk42.checked){
				document.myForm1.chk41.checked=true;
			}
			break;
		case 5:
			if (document.myForm1.chk52.checked){
				document.myForm1.chk51.checked=true;
			}
			break;
		case 6:
			if (document.myForm1.chk62.checked){
				document.myForm1.chk61.checked=true;
			}
			break;
		case 7:
			if (document.myForm1.chk72.checked){
				document.myForm1.chk71.checked=true;
			}
			break;
		case 8:
			if (document.myForm1.chk82.checked){
				document.myForm1.chk81.checked=true;
			}
			break;
		case 9:
			if (document.myForm1.chk92.checked){
				document.myForm1.chk91.checked=true;
			}
			break;
		case 10:
			if (document.myForm1.chk102.checked){
				document.myForm1.chk101.checked=true;
			}
			break;
		case 11:
			if (document.myForm1.chk112.checked){
				document.myForm1.chk111.checked=true;
			}
			break;
		case 12:
			if (document.myForm1.chk122.checked){
				document.myForm1.chk121.checked=true;
			}
			break;
		case 13:
			if (document.myForm1.chk132.checked){
				document.myForm1.chk131.checked=true;
			}
			break;
		case 14:
			if (document.myForm1.chk142.checked){
				document.myForm1.chk141.checked=true;
			}
			break;																																							
	}
}
function dispAccessDetails(){
	var idx, val, arr, mode, upd, access;
	idx=document.myForm1.lstAccess.selectedIndex;
	access=parent.frames[1].document.myForm1.access.value;
	if (access == "superadmin" && idx>0){
		document.myForm1.butDelete.disabled=false;
	}else{
		document.myForm1.butDelete.disabled=true;
	}	
	
	upd=document.myForm1.upd.value;
	if (idx==0){
		if (upd != "Y"){
			window.alert("Sorry!, You have no permission to add new item!!");
			return;
		}
		accessEnable();
		clearAccess();
		mode="NEW";
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=false;
		document.myForm1.btnCancel.disabled=false;		
	}else{
		mode="VIEW";
		val=document.myForm1.lstAccess.options[document.myForm1.lstAccess.selectedIndex].value;
		arr=val.split("|");
		document.myForm1.txtAccess.value=arr[0];
		if (arr[1] == "Y"){
			document.myForm1.chk11.checked=true;
		}else{
			document.myForm1.chk11.checked=false;
		}
		if (arr[2] == "Y"){
			document.myForm1.chk12.checked=true;
		}else{
			document.myForm1.chk12.checked=false;
		}
		if (arr[3] == "Y"){
			document.myForm1.chk21.checked=true;
		}else{
			document.myForm1.chk21.checked=false;
		}
		if (arr[4] == "Y"){
			document.myForm1.chk22.checked=true;
		}else{
			document.myForm1.chk22.checked=false;
		}
		if (arr[5] == "Y"){
			document.myForm1.chk31.checked=true;
		}else{
			document.myForm1.chk31.checked=false;
		}
		if (arr[6] == "Y"){
			document.myForm1.chk32.checked=true;
		}else{
			document.myForm1.chk32.checked=false;
		}				
		if (arr[7] == "Y"){
			document.myForm1.chk41.checked=true;
		}else{
			document.myForm1.chk41.checked=false;
		}
		if (arr[8] == "Y"){
			document.myForm1.chk42.checked=true;
		}else{
			document.myForm1.chk42.checked=false;
		}
		if (arr[9] == "Y"){
			document.myForm1.chk51.checked=true;
		}else{
			document.myForm1.chk51.checked=false;
		}
		if (arr[10] == "Y"){
			document.myForm1.chk52.checked=true;
		}else{
			document.myForm1.chk52.checked=false;
		}						
		if (arr[11] == "Y"){
			document.myForm1.chk61.checked=true;
		}else{
			document.myForm1.chk61.checked=false;
		}
		if (arr[12] == "Y"){
			document.myForm1.chk62.checked=true;
		}else{
			document.myForm1.chk62.checked=false;
		}						
		if (arr[13] == "Y"){
			document.myForm1.chk71.checked=true;
		}else{
			document.myForm1.chk71.checked=false;
		}
		if (arr[14] == "Y"){
			document.myForm1.chk72.checked=true;
		}else{
			document.myForm1.chk72.checked=false;
		}						
		if (arr[15] == "Y"){
			document.myForm1.chk81.checked=true;
		}else{
			document.myForm1.chk81.checked=false;
		}
		if (arr[16] == "Y"){
			document.myForm1.chk82.checked=true;
		}else{
			document.myForm1.chk82.checked=false;
		}						
		if (arr[17] == "Y"){
			document.myForm1.chk91.checked=true;
		}else{
			document.myForm1.chk91.checked=false;
		}
		if (arr[18] == "Y"){
			document.myForm1.chk92.checked=true;
		}else{
			document.myForm1.chk92.checked=false;
		}						
		if (arr[19] == "Y"){
			document.myForm1.chk101.checked=true;
		}else{
			document.myForm1.chk101.checked=false;
		}
		if (arr[20] == "Y"){
			document.myForm1.chk102.checked=true;
		}else{
			document.myForm1.chk102.checked=false;
		}						
		if (arr[21] == "Y"){
			document.myForm1.chk111.checked=true;
		}else{
			document.myForm1.chk111.checked=false;
		}
		if (arr[22] == "Y"){
			document.myForm1.chk112.checked=true;
		}else{
			document.myForm1.chk112.checked=false;
		}						
		if (arr[23] == "Y"){
			document.myForm1.chk121.checked=true;
		}else{
			document.myForm1.chk121.checked=false;
		}
		if (arr[24] == "Y"){
			document.myForm1.chk122.checked=true;
		}else{
			document.myForm1.chk122.checked=false;
		}						
		if (arr[25] == "Y"){
			document.myForm1.chk131.checked=true;
		}else{
			document.myForm1.chk131.checked=false;
		}
		if (arr[26] == "Y"){
			document.myForm1.chk132.checked=true;
		}else{
			document.myForm1.chk132.checked=false;
		}						
		if (arr[27] == "Y"){
			document.myForm1.chk141.checked=true;
		}else{
			document.myForm1.chk141.checked=false;
		}
		if (arr[28] == "Y"){
			document.myForm1.chk142.checked=true;
		}else{
			document.myForm1.chk142.checked=false;
		}
		if (arr[29] == "Y"){
			document.myForm1.chk151.checked=true;
		}else{
			document.myForm1.chk151.checked=false;
		}		
		accessDisable();
		if (upd == "Y"){
			document.myForm1.btnModify.disabled=false;
			document.myForm1.btnSave.disabled=true;
		}else{
			document.myForm1.btnModify.disabled=true;
			document.myForm1.btnSave.disabled=true;
		}
		document.myForm1.btnCancel.disabled=true;								
	}
	document.myForm1.mode.value=mode;
}
function clearAccess(){
	document.myForm1.txtAccess.value="";
	document.myForm1.chk11.checked=false;
	document.myForm1.chk12.checked=false;
	document.myForm1.chk21.checked=false;
	document.myForm1.chk22.checked=false;
	document.myForm1.chk31.checked=false;
	document.myForm1.chk32.checked=false;
	document.myForm1.chk41.checked=false;
	document.myForm1.chk42.checked=false;
	document.myForm1.chk51.checked=false;
	document.myForm1.chk52.checked=false;
	document.myForm1.chk61.checked=false;
	document.myForm1.chk62.checked=false;
	document.myForm1.chk71.checked=false;
	document.myForm1.chk72.checked=false;
	document.myForm1.chk81.checked=false;
	document.myForm1.chk82.checked=false;
	document.myForm1.chk91.checked=false;
	document.myForm1.chk92.checked=false;
	document.myForm1.chk101.checked=false;
	document.myForm1.chk102.checked=false;
	document.myForm1.chk111.checked=false;
	document.myForm1.chk112.checked=false;
	document.myForm1.chk121.checked=false;
	document.myForm1.chk122.checked=false;
	document.myForm1.chk131.checked=false;
	document.myForm1.chk132.checked=false;
	document.myForm1.chk141.checked=false;
	document.myForm1.chk142.checked=false;
	document.myForm1.chk151.checked=false;
}
function  accessModify(){
	var upd;
	upd=document.myForm1.upd.value;
	document.myForm1.mode.value="MODIFY";
	accessEnable();
	if (upd == "Y"){
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=false;
	}else{
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=true;
	}
	document.myForm1.btnCancel.disabled=false;	
}
function accessSave(){
	var url="", mode, txtAccess, upd;
	upd=document.myForm1.upd.value;
	mode=document.myForm1.mode.value;
	txtAccess=document.myForm1.txtAccess.value;
	if (document.myForm1.chk11.checked){
		url+="&chk11=Y";
	}else{
		url+="&chk11=N";
	}
	if (document.myForm1.chk12.checked){
		url+="&chk12=Y";
	}else{
		url+="&chk12=N";
	}
	if (document.myForm1.chk21.checked){
		url+="&chk21=Y";
	}else{
		url+="&chk21=N";
	}
	if (document.myForm1.chk22.checked){
		url+="&chk22=Y";
	}else{
		url+="&chk22=N";
	}	
	if (document.myForm1.chk31.checked){
		url+="&chk31=Y";
	}else{
		url+="&chk31=N";
	}
	if (document.myForm1.chk32.checked){
		url+="&chk32=Y";
	}else{
		url+="&chk32=N";
	}
	if (document.myForm1.chk41.checked){
		url+="&chk41=Y";
	}else{
		url+="&chk41=N";
	}
	if (document.myForm1.chk42.checked){
		url+="&chk42=Y";
	}else{
		url+="&chk42=N";
	}
	if (document.myForm1.chk51.checked){
		url+="&chk51=Y";
	}else{
		url+="&chk51=N";
	}
	if (document.myForm1.chk52.checked){
		url+="&chk52=Y";
	}else{
		url+="&chk52=N";
	}
	if (document.myForm1.chk61.checked){
		url+="&chk61=Y";
	}else{
		url+="&chk61=N";
	}
	if (document.myForm1.chk62.checked){
		url+="&chk62=Y";
	}else{
		url+="&chk62=N";
	}
	if (document.myForm1.chk71.checked){
		url+="&chk71=Y";
	}else{
		url+="&chk71=N";
	}
	if (document.myForm1.chk72.checked){
		url+="&chk72=Y";
	}else{
		url+="&chk72=N";
	}
	if (document.myForm1.chk81.checked){
		url+="&chk81=Y";
	}else{
		url+="&chk81=N";
	}
	if (document.myForm1.chk82.checked){
		url+="&chk82=Y";
	}else{
		url+="&chk82=N";
	}								
	if (document.myForm1.chk91.checked){
		url+="&chk91=Y";
	}else{
		url+="&chk91=N";
	}
	if (document.myForm1.chk92.checked){
		url+="&chk92=Y";
	}else{
		url+="&chk92=N";
	}
	if (document.myForm1.chk101.checked){
		url+="&chk101=Y";
	}else{
		url+="&chk101=N";
	}
	if (document.myForm1.chk102.checked){
		url+="&chk102=Y";
	}else{
		url+="&chk102=N";
	}
	if (document.myForm1.chk111.checked){
		url+="&chk111=Y";
	}else{
		url+="&chk111=N";
	}
	if (document.myForm1.chk112.checked){
		url+="&chk112=Y";
	}else{
		url+="&chk112=N";
	}
	if (document.myForm1.chk121.checked){
		url+="&chk121=Y";
	}else{
		url+="&chk121=N";
	}
	if (document.myForm1.chk122.checked){
		url+="&chk122=Y";
	}else{
		url+="&chk122=N";
	}											
	if (document.myForm1.chk131.checked){
		url+="&chk131=Y";
	}else{
		url+="&chk131=N";
	}
	if (document.myForm1.chk132.checked){
		url+="&chk132=Y";
	}else{
		url+="&chk132=N";
	}
	if (document.myForm1.chk141.checked){
		url+="&chk141=Y";
	}else{
		url+="&chk141=N";
	}
	if (document.myForm1.chk142.checked){
		url+="&chk142=Y";
	}else{
		url+="&chk142=N";
	}
	if (document.myForm1.chk151.checked){
		url+="&chk151=Y";
	}else{
		url+="&chk151=N";
	}	
	if (txtAccess == ""){
		window.alert("Warning!\n\nAccess is Blank\n");
	}else{
		window.location.href="saveAccess.php?mode="+mode+"&txtAccess="+txtAccess+url+"&upd="+upd;
	}													
}
function accessCancel(){
	clearAccess();
}
function accessEnable(){
	document.myForm1.txtAccess.disabled=false;
	document.myForm1.chk11.disabled=false;
	document.myForm1.chk12.disabled=false;
	document.myForm1.chk21.disabled=false;
	document.myForm1.chk22.disabled=false;
	document.myForm1.chk31.disabled=false;
	document.myForm1.chk32.disabled=false;
	document.myForm1.chk41.disabled=false;
	document.myForm1.chk42.disabled=false;
	document.myForm1.chk51.disabled=false;
	document.myForm1.chk52.disabled=false;
	document.myForm1.chk61.disabled=false;
	document.myForm1.chk62.disabled=false;
	document.myForm1.chk71.disabled=false;
	document.myForm1.chk72.disabled=false;
	document.myForm1.chk81.disabled=false;
	document.myForm1.chk82.disabled=false;
	document.myForm1.chk91.disabled=false;
	document.myForm1.chk92.disabled=false;
	document.myForm1.chk101.disabled=false;
	document.myForm1.chk102.disabled=false;
	document.myForm1.chk111.disabled=false;
	document.myForm1.chk112.disabled=false;
	document.myForm1.chk121.disabled=false;
	document.myForm1.chk122.disabled=false;
	document.myForm1.chk131.disabled=false;
	document.myForm1.chk132.disabled=false;
	document.myForm1.chk141.disabled=false;
	document.myForm1.chk142.disabled=false;
	document.myForm1.chk151.disabled=false;
}
function accessDisable(){
	document.myForm1.txtAccess.disabled=true;
	document.myForm1.chk11.disabled=true;
	document.myForm1.chk12.disabled=true;
	document.myForm1.chk21.disabled=true;
	document.myForm1.chk22.disabled=true;
	document.myForm1.chk31.disabled=true;
	document.myForm1.chk32.disabled=true;
	document.myForm1.chk41.disabled=true;
	document.myForm1.chk42.disabled=true;
	document.myForm1.chk51.disabled=true;
	document.myForm1.chk52.disabled=true;
	document.myForm1.chk61.disabled=true;
	document.myForm1.chk62.disabled=true;
	document.myForm1.chk71.disabled=true;
	document.myForm1.chk72.disabled=true;
	document.myForm1.chk81.disabled=true;
	document.myForm1.chk82.disabled=true;
	document.myForm1.chk91.disabled=true;
	document.myForm1.chk92.disabled=true;
	document.myForm1.chk101.disabled=true;
	document.myForm1.chk102.disabled=true;
	document.myForm1.chk111.disabled=true;
	document.myForm1.chk112.disabled=true;
	document.myForm1.chk121.disabled=true;
	document.myForm1.chk122.disabled=true;
	document.myForm1.chk131.disabled=true;
	document.myForm1.chk132.disabled=true;
	document.myForm1.chk141.disabled=true;
	document.myForm1.chk142.disabled=true;
	document.myForm1.chk151.disabled=true;
}
function accessSetup(){
	accessDisable();
	document.myForm1.btnModify.disabled=true;
	document.myForm1.btnSave.disabled=true;
	document.myForm1.btnCancel.disabled=true;	
}
function loadUserList(val){
	var upd;
	upd=document.myForm1.upd.value;
	if (val == 1){
		window.location.href="userAccounts.php?user=1&upd="+upd;
	}else{
		window.location.href="userAccounts.php?user=2&upd="+upd;
	}
}
function dispAccountsDetails(){
	var val, arr, i, upd, access, idx;
	upd=document.myForm1.upd.value;
	
	access=parent.frames[1].document.myForm1.access.value;
	
	if (document.myForm1.lstUsers.selectedIndex == 0 && document.myForm1.rad1[1].checked){
		idx=document.myForm1.lstUsers.selectedIndex;
		if (access == "superadmin" && idx>0){
			document.myForm1.butDelete.disabled=false;
		}else{
			document.myForm1.butDelete.disabled=true;
		}	
		if (upd != "Y"){
			window.alert("Sorry!, you have no permission to add new item!!");
			return;
		}
		clearAccFields();
		document.myForm1.btnModify.disabled=true;
		document.myForm1.btnSave.disabled=false;
		document.myForm1.btnCancel.disabled=false;
		userEnable();
		document.myForm1.mode.value="NEW";
	}else{
		if (access == "superadmin"){
			document.myForm1.butDelete.disabled=false;
		}else{
			document.myForm1.butDelete.disabled=true;
		}	
	
		val=document.myForm1.lstUsers.options[document.myForm1.lstUsers.selectedIndex].value;
		arr=val.split("|");
		document.myForm1.txtFname.value=arr[3];
		document.myForm1.txtLname.value=arr[4];
		document.myForm1.txtUtype.value=arr[6];
		document.myForm1.txtEmail.value=arr[7];
		document.myForm1.txtID.value=arr[0];
		document.myForm1.txtPwd.value=arr[1];
		if (arr[8] == "Y"){
			document.myForm1.chkActive.checked=true;
		}else{
			document.myForm1.chkActive.checked=false;
		}
		for(i=0; i<document.myForm1.lstAccess.length; i++){
			if (document.myForm1.lstAccess.options[i].text == arr[2]){
				document.myForm1.lstAccess.selectedIndex=i;
				break;
			}
		}
		if (upd == "Y"){
			document.myForm1.btnModify.disabled=false;
			document.myForm1.btnSave.disabled=true;
		}else{
			document.myForm1.btnModify.disabled=true;
			document.myForm1.btnSave.disabled=true;
		}
		document.myForm1.btnCancel.disabled=true;
		userDisable();		
	}
}
function clearAccFields(){
	document.myForm1.txtFname.value="";
	document.myForm1.txtLname.value="";
	document.myForm1.txtUtype.value="staff";
	document.myForm1.txtEmail.value="";
	document.myForm1.txtID.value="";
	document.myForm1.txtPwd.value="";
	document.myForm1.chkActive.checked=false;
	document.myForm1.lstAccess.selectedIndex=0;
}
function userCancel(){
	clearAccFields();
}
function userModify(){
	document.myForm1.btnModify.disabled=true;
	document.myForm1.btnSave.disabled=false;
	document.myForm1.btnCancel.disabled=false;
	if (document.myForm1.rad1[0].checked){
		userDisable();
		document.myForm1.txtPwd.disabled=false;
		document.myForm1.chkActive.disabled=false;
	}else{
		userDisable();
		document.myForm1.txtFname.disabled=false;
		document.myForm1.txtLname.disabled=false;
		document.myForm1.txtUtype.disabled=true;
		document.myForm1.txtEmail.disabled=false;
		document.myForm1.txtID.disabled=true;
		document.myForm1.chkActive.disabled=true;
		document.myForm1.txtPwd.disabled=false;
		document.myForm1.lstAccess.disabled=false;
		document.myForm1.chkActive.disabled=false;		
	}
	document.myForm1.mode.value="MODIFY";
}
function userSave(){
	var mode, type1, fname, lname, email, access, uid, pwd, err="", upd, active;
	upd=document.myForm1.upd.value;
	if (document.myForm1.rad1[0].checked){
		document.myForm1.type1.value="MEMBER";
	}else{
		document.myForm1.type1.value="STAFF";
	}
	mode=document.myForm1.mode.value;
	type1=document.myForm1.type1.value;
	
	fname=document.myForm1.txtFname.value;
	lname=document.myForm1.txtLname.value;
	email=document.myForm1.txtEmail.value;
	access=document.myForm1.lstAccess.options[document.myForm1.lstAccess.selectedIndex].text;
	uid=document.myForm1.txtID.value;
	pwd=document.myForm1.txtPwd.value;
	//window.alert(mode+"|"+type1);
	if (mode == "NEW"){
		if (type1 == "STAFF"){
			//window.alert("hI");
			if (fname == ""){
				err+="First Name is blank\n";
			}
			if (lname == ""){
				err+="Last Name is blank\n";
			}
			if (email == ""){
				err+="Email is blank\n";
			}
			if (uid == ""){
				err+="UserID is blank\n";
			}
			if (pwd == ""){
				err+="Password is blank\n";
			}
			if (access == " " || access== "user"){
				err+="Invalid Access for Staff\n";
			}
			//window.alert(err);
		}
	}else{
		if (type1 == "STAFF"){
			if (fname == ""){
				err+="First Name is blank\n";
			}
			if (lname == ""){
				err+="Last Name is blank\n";
			}
			if (email == ""){
				err+="Email is blank\n";
			}
			if (uid == ""){
				err+="UserID is blank\n";
			}
			if (pwd == ""){
				err+="Password is blank\n";
			}
			if (access == "" || access== "user"){
				err+="Invalid Access for Staff\n";
			}
		}else{
			if (pwd == ""){
				err+="Password is blank\n";
			}		
		}
	}
	//window.alert(err);
	if (err != ""){
		window.alert("Warning!\n\n"+err+"\n");
	}else{
		if (document.myForm1.chkActive.checked){
			active="Y";
		}else{
			active="N";
		}
		window.location.href="saveAccount.php?fname="+fname+"&lname="+lname+"&email="+email+"&uid="+uid+"&pwd="+pwd+"&access="+access+"&mode="+mode+"&type1="+type1+"&upd="+upd+"&active="+active;
	}	
}
function userDisable(){
	document.myForm1.txtFname.disabled=true;
	document.myForm1.txtLname.disabled=true;
	document.myForm1.txtUtype.disabled=true;
	document.myForm1.txtEmail.disabled=true;
	document.myForm1.txtID.disabled=true;
	document.myForm1.txtPwd.disabled=true;
	document.myForm1.lstAccess.disabled=true;
	document.myForm1.chkActive.disabled=true;
}
function userEnable(){
	document.myForm1.txtFname.disabled=false;
	document.myForm1.txtLname.disabled=false;
	document.myForm1.txtUtype.disabled=false;
	document.myForm1.txtEmail.disabled=false;
	document.myForm1.txtID.disabled=false;
	document.myForm1.txtPwd.disabled=false;
	document.myForm1.lstAccess.disabled=false;
	document.myForm1.chkActive.disabled=false;
}
function adminLogin(){
	var uid, pwd;
	uid=document.myForm1.txtUid.value;
	pwd=document.myForm1.txtPwd.value;
	//window.alert(uid+"|"+pwd);
	window.location.href="adminLogin.php?uid="+uid+"&pwd="+pwd;
}
function itemDelete(){
	var catId, subCatId, itemId, upd, access, itemName, ans;
	catId=document.myForm.catId.value;
	subCatId=document.myForm.subCatId.value;
	itemId=document.myForm.lstItems.options[document.myForm.lstItems.selectedIndex].value;
	upd=document.myForm.upd.value;
	access=parent.frames[1].document.myForm1.access.value;
	itemName=document.myForm.lstItems.options[document.myForm.lstItems.selectedIndex].text;
	ans=window.confirm("Warning!\n\nThe Item :"+itemName+"\n\nwill be Deleted!!\n\nPlease confirm\n\n");
	if (ans == true){
		window.location.href="deleItem.php?catId="+catId+"&subCatId="+subCatId+"&itemId="+itemId+"&upd="+upd+"&access="+access;
	}
}
function songDelete(){
	var songid1, upd, access, songname, ans, arr, songid;
	songid1=document.myForm1.lstItems.options[document.myForm1.lstItems.selectedIndex].value;
	arr=songid1.split("|");
	songid=arr[0];
	upd=document.myForm1.upd.value;
	access=parent.frames[1].document.myForm1.access.value;
	songname=document.myForm1.lstItems.options[document.myForm1.lstItems.selectedIndex].text;
	ans=window.confirm("Warning!\n\nThe Song :"+songname+"\n\nwill be Deleted!!\n\nPlease confirm\n\n");
	if (ans == true){
		window.location.href="deleSong.php?songid="+songid+"&upd="+upd+"&access="+access;
	}
}
function accessDelete(){
	var access1, upd, access, acc1, arr;
	acc1=document.myForm1.lstAccess.options[document.myForm1.lstAccess.selectedIndex].value;
	arr=acc1.split("|");
	access1=arr[0];
	upd=document.myForm1.upd.value;
	access=parent.frames[1].document.myForm1.access.value;
	ans=window.confirm("Warning!\n\nThe Access :"+access1+"\n\nwill be Deleted!!\n\nPlease confirm\n\n");
	if (ans == true){
		window.location.href="deleAccess.php?access1="+access1+"&upd="+upd+"&access="+access;
	}
}
function accountDelete(){
	var userid, upd, access, username, uid1, arr;
	uid1=document.myForm1.lstUsers.options[document.myForm1.lstUsers.selectedIndex].value;
	arr=uid1.split("|");
	userid=arr[0];
	username=document.myForm1.lstUsers.options[document.myForm1.lstUsers.selectedIndex].text;
	upd=document.myForm1.upd.value;
	access=parent.frames[1].document.myForm1.access.value;
	ans=window.confirm("Warning!\n\nThe User :"+username+"\n\nwill be Deleted!!\n\nPlease confirm\n\n");
	if (ans == true){
		window.location.href="deleAccounts.php?userid="+userid+"&upd="+upd+"&access="+access;
	}
}
function memDelete(){
	var memberid, upd, access, username, uid1, arr;
	uid1=document.myForm1.lstMem.options[document.myForm1.lstMem.selectedIndex].value;
	arr=uid1.split("|");
	memberid=arr[18];
	username=document.myForm1.lstMem.options[document.myForm1.lstMem.selectedIndex].text;
	upd=document.myForm1.upd.value;
	access=parent.frames[1].document.myForm1.access.value;
	ans=window.confirm("Warning!\n\nThe User :"+username+"\n\nwill be Deleted!!\n\nPlease confirm\n\n");
	if (ans == true){
		window.location.href="deleMem.php?memberid="+memberid+"&upd="+upd+"&access="+access;
	}
}
function chkType1(){
	var idx;
	idx=document.myForm1.lstType.selectedIndex;
	if (idx ==0){
		document.myForm1.txtOth.disabled=true;
		document.myForm1.txtDob.disabled=false;
	}
	if (idx ==1){
		document.myForm1.txtOth.disabled=true;
		document.myForm1.txtDob.disabled=true;
	}
	if (idx ==2){
		document.myForm1.txtOth.disabled=false;
		document.myForm1.txtDob.disabled=true;
	}
	
}

