/*
=:: JavaScript Document ::=
Document wrtitten by : Prashant Patil
Date : 27-06-08
*/

Doc = D = d = document;
function HideShow(first, second, id) {
	if(id == 1) {
		try {
			Object(first).style.display = "inline";
			Object(second).style.display = "none";
		}
		catch(e) {
			alert(e);
			Object(first).style.visibility = "visible";
			Object(second).style.visibility = "hidden";
		}
	}
	if(id == 2) {
		try {
			Object(first).style.display = "none";
			Object(second).style.display = "inline";
		}
		catch(e) {
			alert(e);
			Object(first).style.visibility = "hidden";
			Object(second).style.visibility = "visible";
		}
	}
}

function hideshow(first)
{
	try{
		if(Object(first).style.display=='none'){
			Object(first).style.display='block'; // - minus image
			if(Object(first+'_img-')) {
				Object(first+'_img-').style.display='block';
				Object(first+'_img+').style.display='none';
			}
		}
		else {
			Object(first).style.display='none'; // + minus image
			if(Object(first+'_img-')) {
				Object(first+'_img-').style.display='none';
				Object(first+'_img+').style.display='block';
			}
		}
	}
	catch(e){
		if(Object(first).style.visibility=='hidden') {
			Object(first).style.visibility='visible'; // - minus image
			if(Object(first+'_img+')) {
				Object(first+'_img+').style.display='hidden';
				Object(first+'_img-').style.display='visible';
			}
		}
		else {
			Object(first).style.visibility='hidden'; // + minus image
			if(Object(first+'_img+')) {
				Object(first+'_img+').style.display='visible';
				Object(first+'_img-').style.display='hidden';
			}
		}
	}
	return;
}

function Object(ele) {
	return D.getElementById(ele);
}

//*************** Email function BOF **************
function validateEmailIDs(ele)
{
		var J=Object(ele);		
		var H;
		if(J!=null)
		{
			H=Trims(J.value)
		}
		if(H.length<=0)
		{			
			J.value = '';			
			return false

		}
		var I=H.match("^(.+)@(.+)$");
		if(I==null)
		{
			alert("Please check Email-ID");
			J.value = '';
			return false
		}
		if(H.indexOf("..",0)!=-1)
		{
			alert("Please check Email-ID");
			J.value = '';
			return false
		}
		if(I[1]!=null)
		{
			var G=/^\"?[\w-_\.]*\"?$/;
			if(I[1].match(G)==null)
			{
				alert("Please check Email-ID");
				J.value = '';
				return false
			}
		}
		if(I[2]!=null)
		{
			var A=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
			if(I[2].match(A)==null)
			{
				var E=/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
				if(I[2].match(E)==null)
				{
					alert("Please check Email-ID");
					J.value = '';
					return false
				}
			}
			return true
		}
		return false
}
//*************** Email function EOF **************

//*************** Text function BOF ***************
function validateOnlyAlphas(ele)
{
	var eleById=Object(ele);
	var D = '';
	if(eleById!=null)
	{
		D=Trims(eleById.value);
	}	
	if(D!='')
	var G=D.search("[^A-Za-z0-9]");
	if(D!='')
	if(D.length>0&&G>=0)
	{
		alert("Enter Only Alpha Numeric Values !");
		eleById.value = "";
		eleById.focus();
		return false;
	}
	else
	{
		return true;
	}
}
function validateOnlyCharas(ele)
{
	var eleById=Object(ele);
	var D = '';
	if(eleById!=null)
	{
		D=Trims(eleById.value);
	}	
	if(D!='')
	var G=D.search("/^[a-zA-Z]+$/");
	if(D!='')
	if(D.length>0&&G>=0)
	{
		alert("Enter Only Alpha Numeric Values !");
		eleById.value = "";
		eleById.focus();
		return false;
	}
	else
	{
		return true;
	}
}
//*************** Text function BOF ***************

//*************** Numeric function BOF ***************
function validateOnlyNumericals(ele)
{
	
	try
	{
		var eleById=ele;
		var F='';
		if(eleById!=null)
		{
			F=Trims(eleById.value);
		}
		var I="0123456789/";
		var G=true;
		var D='';
		for(i=0;i<F.length&&G==true;i++)
		{
			D=F.charAt(i);
			if(I.indexOf(D)==-1)
			{
				alert("Enter Only Numbers!");
				eleById.value = "";
				eleById.focus();
				G=false;
			}
		}
	}
	catch(C)
	{
		txt="There was an error on this page.\n\n";
		txt+="Error description: "+C.description+"\n\n";
		txt+="Click OK to continue.\n\n";
		alert(txt);
	}
	return G;
}
//*************** Numeric function EOF ***************


//*************** Trim function BOF ***************
function Trims(value)
{
	if(value.length < 1)
	{
		return "";
	}
	value=RTrim(value);
	value=LTrim(value);
	if(value=="")
	{
		return "";
	}
	else
	{
		return value;
	}
}
function RTrim(C)
{
	var D=String.fromCharCode(32);
	var E=C.length;
	var B="";
	if(E<0)
	{
		return "";
	}
	var A = E - 1;
	while(A > -1)
	{
		if(C.charAt(A) == D)
		{}
		else
		{
			B=C.substring(0, A+1);
			break
		}
		A = A-1;
	}
	return B;
}
function LTrim(C)
{
	var D=String.fromCharCode(32);
	if(E<1)
	{
		return "";
	}
	var E = C.length;
	var B = "";
	var A = 0;
	while(A < E)
	{
		if(C.charAt(A) == D)
		{}
		else
		{
			B = C.substring(A, E);
			break
		}
		A = A+1;
	}
	return B;
}
function isBlank(ele)
{
	if(Object(ele).value=='')
	{
		Khaki(ele);
		return true;
	}
	{
		White(ele);
		return false;
	}
}

function isEquals(ele1,ele2)
{
	if(Object(ele1).value==Object(ele2).value)
		return true;
	return false;
}

function Khaki(id)
{
	Object(id).style.backgroundColor = "";
}

function White(id)
{
	Object(id).style.backgroundColor = "";
}
function setHTML(ele,msg)
{
	Object(ele).innerHTML = msg;	
}
function confirm_delete()
{
	if(!confirm("Delete this record(s) ?"))
		return false;
	return true;
}

function confirm_exit()
{
	if(!confirm("Exit ?"))
		return false;
	return true;
}

function showtext(ID, text) {
	Object(ID).innerHTML = text;
}

function cleartext(ID) {
	Object(ID).innerHTML = '';
}

function clearHTML(elem) {
	Object(elem).innerHTML = '';
}

function setVisibility(id, visibility)
{
	if(visibility=='block') {
		Object(id).style.display = visibility;
		showanimate(0, 0, id);
	} else {
		closeanimate(0, 100, id);
	}
	return false;
}

function closeanimate($i, opac, divid) {	// closeanimate(0, 100, 'prash');
	opac = (parseInt(opac)-4);
	Object(divid).style.filter = 'alpha(opacity='+parseInt(opac)+')';
	Object(divid).style.opacity = (parseInt(opac)/100);
	if($i!=25) {
		$i++;
		setTimeout("closeanimate("+$i+","+opac+", '"+divid+"')", 1);
	}
	else {
		Object(divid).style.display='none';
	}
}

function showanimate($i, opac, divid) {		// showanimate(0, 0, 'prash');
	opac = (parseInt(opac)+4);
	Object(divid).style.filter = 'alpha(opacity='+parseInt(opac)+')';
	Object(divid).style.opacity = (parseInt(opac)/100);
	if($i!=25) {
		$i++;
		setTimeout("showanimate("+$i+","+opac+", '"+divid+"')", 1);
	}
}

function hideAllChilds(id) {
	var ParentObj = Object(id);	
	for(i=0; i<ParentObj.childNodes.length; i++) {
		alert(ParentObj.childNodes[i].attributes);
		// for(atr in ParentObj.childNodes[i])
			
//		ParentObj.childNodes[i].style.display = 'none';
	}
}
// **********************************************************************************

// if returnFlag=='true' then returns result in integer i.e. no. of selected checkboxes
// if returnFlag=='id' then returns result in array format & array should contain checkbox values
function getSelectedCheckboxes(idstr, returnFlag)
{
	var selectedchks = 0;
	var limit = document.getElementsByName(idstr+'[]').length;
	var selectedcheckboxesarray = new Array(limit);
	for(var i=0; i<limit; i++)
	{
		obj = Object(idstr+'['+i+']');
		if(obj.checked==true)
			selectedchks = parseInt(selectedchks)+1;
		selectedcheckboxesarray[i] = idstr+"["+i+"]  ==>  "+ obj.value;
	}
	if(typeof returnFlag == 'undefined')
		return selectedchks;
	return selectedcheckboxesarray;
}

function selectAllCheckboxes(idstr, select_or_clear)
{
	var limit = document.getElementsByName(idstr+'[]').length;
	var selectedcheckboxesarray = new Array(limit);
	// if Select All Button Is Selected Then "Select All Options" else "Deselect All"
	if(select_or_clear=='selectall')
		for(var i=0; i<limit; i++)
			obj = Object(idstr+'['+i+']').checked=true;
	else 
		if(select_or_clear=='clearall')
			for(var i=0; i<limit; i++)
				obj = Object(idstr+'['+i+']').checked=false;
}

// functionality remaining
function getFileExtension(value)
{
	var extension = value.split(".",2);
	if(extension[1]=="jpeg" || extension[1]=="jpg" || extension[1]=="bmp" || extension[1]=="gif")
	{ 
	return true;}
	else 
	{
		return false;
	}

}
function getFileExtensionVideo(value)
{
	var extension = value.split(".",2);
	if(extension[1]=="mpeg" || extension[1]=="mpg" || extension[1]=="wav" || extension[1]=="mov" || extension[1]=="wmv" || extension[1]=="flv" )
	{ 
	return true;}
	else 
	{
		return false;
	}

}
function tell_validation()
{
		rtnVal = true;
	rtnFields = "";

	if(document.frm_tell.yourname.value == ""){
	    document.frm_tell.yourname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Your Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_tell.yourname.style.backgroundColor="White";
	
		if(!document.getElementById('yourname').value.match(/^[a-zA-Z]+$/)){
			rtnFields = rtnFields + "Enter only characters, ";
	     	rtnVal = false;
		}
		else
		{
			if(! lengthRestriction(document.getElementById('yourname'),3)){
					
					return false;
				}
		}
	}
	if(document.frm_tell.youremail.value == ""){
	    document.frm_tell.youremail.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Email Id, ";
		rtnVal = false;
	}
	else{
	    document.frm_tell.youremail.style.backgroundColor="White";	
		if(emailValidator(document.getElementById('youremail'),"Not Valid Email Id")==false ){
				return false;
			
			}
	}

	
	if(document.frm_tell.friendname.value == ""){
	    document.frm_tell.friendname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Friend Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_tell.friendname.style.backgroundColor="White";	
 		if(!document.getElementById('friendname').value.match(/^[a-zA-Z]+$/)){
				rtnFields = rtnFields + "Enter only characters, ";
				rtnVal = false;
		}
		else
		{
			if(! lengthRestriction(document.getElementById('friendname'),3)){
					
					return false;
			}
	   }
	}
	
	if(document.frm_tell.friendemail.value == ""){
	    document.frm_tell.friendemail.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Email Id, ";
		rtnVal = false;
	}
	else{
	    document.frm_tell.friendemail.style.backgroundColor="White";	
		if(emailValidator(document.getElementById('friendemail'),"Not Valid Email Id")==false){
			return false;	
			
			}
	}
	

	
	if(rtnVal == false)
	{
		alert("Fields Empty :  " + rtnFields);
		return false;
	}
	document.frm_tell.submit();	
}
function contact_validation()
{
		rtnVal = true;
	rtnFields = "";

	if(document.frm_contactus.yourname.value == ""){
	    document.frm_contactus.yourname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Your Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_contactus.yourname.style.backgroundColor="White";
	
		if(!document.getElementById('yourname').value.match(/^[a-zA-Z]+$/)){
			rtnFields = rtnFields + "Enter only characters, ";
	     	rtnVal = false;
		}
		else
		{
			if(! lengthRestriction(document.getElementById('yourname'),3)){
					
					return false;
				}
		}
	}
	if(document.frm_contactus.youremail.value == ""){
	    document.frm_contactus.youremail.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Email Id, ";
		rtnVal = false;
	}
	else{
	    document.frm_contactus.youremail.style.backgroundColor="White";	
		if(emailValidator(document.getElementById('youremail'),"Not Valid Email Id")==false ){
				return false;
			
			}
	}	
	
if(document.frm_contactus.message.value == ""){
	    document.frm_contactus.message.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Message, ";
		rtnVal = false;
	}
	else{
	    document.frm_contactus.message.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('message'),3)){
				
				return false;
			}
	}
	

	
	if(rtnVal == false)
	{
		alert("Fields Empty :  " + rtnFields);
		return false;
	}
	document.frm_contactus.submit();	
}

function loginvalidation()
{
	if(isBlank('username'))
	{
		alert("Please Enter Username!");
		return false;
	}
	
		if(isBlank('password'))
		{
			alert("Please Enter Password!");
			return false;
		}
		return true;
}



function sitevalidations()
{
   rtnVal = true;
	rtnFields = "";

	if(document.frm_site.edit_name.value == ""){
	    document.frm_site.edit_name.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Site Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_site.edit_name.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('edit_name'),3)){
				
				return false;
			}
	}

	if(document.frm_site.user.value == ""){
	    document.frm_site.user.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "User Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_site.user.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('user'),3)){
				
				return false;
			}
	}
	
	
	if(document.frm_site.pass.value == "")
	{
		document.frm_site.pass.style.backgroundColor="Khaki";
		document.frm_site.pass2.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Password, ";
		rtnVal = false;
	}
	else
	{
		if(! lengthRestriction(document.getElementById('pass'),3))
		{
				
				return false;
		}
		else
		{
			if(document.frm_site.pass.value == document.frm_site.pass2.value)
			{					
				document.frm_site.pass.style.backgroundColor="White";
				document.frm_site.pass2.style.backgroundColor="White";			
     		}
  			else
			{
				document.frm_site.pass.style.backgroundColor="Khaki";
				document.frm_site.pass2.style.backgroundColor="Khaki";
				rtnFields = rtnFields + "Retype Password!, ";
				rtnVal = false;
         	}
   	   }
		
  }
	if(document.frm_site.email.value.indexOf("@") == -1 || document.frm_site.email.value.indexOf(".") == -1){
		if(document.frm_site.email.value == ""){
			document.frm_site.email.style.backgroundColor="Khaki";
			rtnFields = rtnFields + "Check Email ID";
			rtnVal = false;
		}
		else
		{
			document.frm_site.email.style.backgroundColor="Khaki";
			rtnFields = rtnFields + "Email ID Not Valid, ";
			rtnVal = false;
		}
	}
	else{
	    document.frm_site.email.style.backgroundColor="White";	
	}
	
	if(document.frm_site.contactusid.value.indexOf("@") == -1 || document.frm_site.contactusid.value.indexOf(".") == -1){
		if(document.frm_site.contactusid.value == ""){
			document.frm_site.contactusid.style.backgroundColor="Khaki";
			rtnFields = rtnFields + "Check Contact Us Email ID,  ";
			rtnVal = false;
		}
		else
		{
			document.frm_site.contactusid.style.backgroundColor="Khaki";
			rtnFields = rtnFields + "Contact Us Email ID Not Valid, ";
			rtnVal = false;
		}
	}
	else{
	    document.frm_site.contactusid.style.backgroundColor="White";	
	}

   	if(document.frm_site.registrationid.value.indexOf("@") == -1 || document.frm_site.registrationid.value.indexOf(".") == -1){
		if(document.frm_site.registrationid.value == ""){
			document.frm_site.registrationid.style.backgroundColor="Khaki";
			rtnFields = rtnFields + "Check Registration  Email ID,  ";
			rtnVal = false;
		}
		else
		{
			document.frm_site.registrationid.style.backgroundColor="Khaki";
			rtnFields = rtnFields + "Registration  Email ID Not Valid, ";
			rtnVal = false;
		}
	}
	else{
	    document.frm_site.registrationid.style.backgroundColor="White";	
	}
	
		
		if(document.frm_site.keyword.value == ""){
			document.frm_site.keyword.style.backgroundColor="Khaki";
			rtnFields = rtnFields + "Enter Meta Keyword, ";
			rtnVal = false;
		}	
		if(document.frm_site.metadesc.value == ""){
			document.frm_site.metadesc.style.backgroundColor="Khaki";
			rtnFields = rtnFields + "Enter Meta Description, ";
			rtnVal = false;
		}		
		if(document.frm_site.siteurl.value == ""){
			document.frm_site.siteurl.style.backgroundColor="Khaki";
			rtnFields = rtnFields + "Enter Site Url ";
			rtnVal = false;
		}
		else
		{			
			var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;		
			if (!tomatch.test(document.frm_site.siteurl.value))
			{				
				rtnFields = rtnFields + "Enter Valid Url";
				rtnVal = false; 
			}		
		
        }
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_site.submit();
}


// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
function trim(s)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not a whitespace, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (c != " ") returnString += c;
    }
    return returnString;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
var bracket=3
strPhone=trim(strPhone)
if(strPhone.indexOf("+")>1) return false
if(strPhone.indexOf("-")!=-1)bracket=bracket+1
if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
var brchr=strPhone.indexOf("(")
if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function lengthRestriction(elem, min, max)
	{
		var uInput = elem.value;
		if(uInput.length >= min )
		{
			return true;
		}
		else
		{
			alert(" It must be minimun " + min );
			elem.focus();
			return false;
		}
	}


function categoryvalidation()
{
	rtnVal = true;
	rtnFields = "";

 
	if(document.frm_category.categoryname.value == ""){
	    document.frm_category.categoryname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Category Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_category.categoryname.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('categoryname'),3)){
				
				return false;
			}
	}

	if(document.frm_category.cat_image.value != ""){
	   if(!getFileExtension(document.frm_category.cat_image.value))
		 {
		  rtnFields = rtnFields + "File extension is not valid, ";	 
	      rtnVal = false; 
		 }
	}
	
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_category.submit();
	
}

function productvalidation()
{
	rtnVal = true;
	rtnFields = "";
	 
	
 if(document.frm_product.product_name.value == ""){
	    document.frm_product.product_name.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Product Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_product.product_name.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('product_name'),3)){
				
				return false;
			}
	}
	if(document.frm_product.category_name.value == ""){
	    document.frm_product.category_name.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Category Name, ";
		rtnVal = false;
	}
	if(document.frm_product.product_img.value == ""){
	    document.frm_product.product_img.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Product Image, ";
		rtnVal = false;
	}
	else{
		
		 if(!getFileExtension(document.frm_product.product_img.value))
		 {
		  rtnFields = rtnFields + "File extension is not valid, ";	 
	      rtnVal = false; 
		 }
	}	

	if(document.frm_product.product_price.value == ""){
	    document.frm_product.product_price.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Product Price ";
		rtnVal = false;
	}

	
	
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_product.submit();
	
}

function uservalidation()
{
		rtnVal = true;
	rtnFields = "";

	if(document.frm_member.fullname.value == ""){
	    document.frm_member.fullname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "First Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.fullname.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('fullname'),3)){
				
				return false;
			}
	}
	if(document.frm_member.addLine1.value == ""){
	    document.frm_member.addLine1.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Address Line 1, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.addLine1.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('addLine1'),3)){
				
				return false;
			}
	}
	
	if(document.frm_member.addLine2.value == ""){
	    document.frm_member.addLine2.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Address Line 2, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.addLine2.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('addLine2'),3)){
				
				return false;
			}
	}
	
	if(document.frm_member.city.value == ""){
	    document.frm_member.city.style.backgroundColor="Khaki";
		rtnFields = rtnFields + " City, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.city.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('city'),3)){
				
				return false;
			}
	}
	if(document.frm_member.state.value == ""){
	    document.frm_member.state.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "State, ";
		rtnVal = false;
	}
	if(document.frm_member.phone.value == ""){
	    document.frm_member.phone.style.backgroundColor="Khaki";
		rtnFields = rtnFields + " Phone No., ";
		rtnVal = false;
	}
	/*else{
	    document.frm_member.phone.style.backgroundColor="White";
		//var re10digit= /^\d{2,3}-\d{9}$/;  
		if (!document.getElementById('phone').value.match(re10digit))  
		{ 
		//if(checkInternationalPhone()==false){
			rtnFields = rtnFields + " Phone no. must be in international format, ";	
			rtnVal = false;
		}
		/*if(!check_usphone(document.getElementById('phone').value,''))
		{
			rtnFields = rtnFields + " Phone no. must be in Aus format, ";	
			rtnVal = false;
		}	*/											 
	/*	
		if(validateOnlyNumericals(document.getElementById('phone'))==false){
			rtnFields = rtnFields + " Phone no. must be in numbers, ";	
			rtnVal = false;
			}*/
	/*}*/
	
	
	if(document.frm_member.email.value == ""){
	    document.frm_member.email.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Email Id, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.email.style.backgroundColor="White";	
			if(document.frm_member.email.value.indexOf("@") == -1 || document.frm_member.email.value.indexOf(".") == -1){
				rtnFields = rtnFields + " Enter valid email id, ";
				rtnVal = false;
			}
	}
	

	
	if(document.frm_member.postcode.value == ""){
	    document.frm_member.postcode.style.backgroundColor="Khaki";
		rtnFields = rtnFields + " Postcode, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.postcode.style.backgroundColor="White";	
		if(validateOnlyNumericals(document.getElementById('postcode'))==false){
			rtnFields = rtnFields + " Post code must be in numbers, ";	
			rtnVal = false;
			}
	}

	
	if(document.frm_member.username.value == ""){
	    document.frm_member.username.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Username, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.username.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('username'),3)){
				
				return false;
			}
	}
	if(document.frm_member.password.value == ""){
	    document.frm_member.password.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Password, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.password.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('password'),3)){
				
				return false;
			}
	}


	
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_member.submit();	
}


function validcheckout()
{
	rtnVal = true;
	rtnFields = "";
	
	if(!document.frm_payment.terms.checked){
		rtnFields = rtnFields + "terms and conditions ";
		rtnVal = false;		
	}
	if(rtnVal == false)
	{
		alert("Please agree the  " + rtnFields);
		return false;
	}
	document.frm_payment.submit();	
	
}

function precheckout_validation()
{
	rtnVal = true;
	rtnFields = "";
	if(document.frm_payment.billadd1.value == ""){
	    document.frm_payment.billadd1.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Billing Address Line 1 ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.billadd1.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('billadd1'),3)){
				
				return false;
			}
	}
	 
	if(document.frm_payment.billadd2.value == ""){
	    document.frm_payment.billadd2.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Billing Address Line 2 ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.billadd2.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('billadd1'),3)){			
				return false;
		}
	}
	
	if(document.frm_payment.billphone.value == ""){
	    document.frm_payment.billphone.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Billing Phone ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.billphone.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('billphone'),3)){
				
				return false;
			}
	}
	
	if(document.frm_payment.billcity.value == ""){
	    document.frm_payment.billcity.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Billing City ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.billcity.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('billcity'),3)){
				
				return false;
			}
	}
	
	if(document.frm_payment.billstate.value == ""){
	    document.frm_payment.billstate.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Billing State ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.billstate.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('billstate'),2)){
				
				return false;
			}
	}
	
	if(document.frm_payment.billpostcode.value == ""){
	    document.frm_payment.billpostcode.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Billing Postal Code ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.billpostcode.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('billpostcode'),3)){
				
				return false;
			}
	}
	
	if(document.frm_payment.shipadd1.value == ""){
	    document.frm_payment.shipadd1.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Shipping Address Line 1 ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.shipadd1.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('shipadd1'),3)){
				
				return false;
			}
	}
	
	if(document.frm_payment.shipadd2.value == ""){
	    document.frm_payment.shipadd2.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Shipping Address Line 2, ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.shipadd2.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('shipadd2'),3)){
				
				return false;
			}
	}
	
	if(document.frm_payment.shipphone.value == ""){
	    document.frm_payment.shipphone.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Shipping Phone Details ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.shipphone.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('shipphone'),3)){
				
				return false;
			}
	}
	
	if(document.frm_payment.shipcity.value == ""){
	    document.frm_payment.shipcity.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Shipping City ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.shipcity.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('shipcity'),3)){
				
				return false;
			}
	}
	
	if(document.frm_payment.shipstate.value == ""){
	    document.frm_payment.shipstate.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Shipping State ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.shipstate.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('shipstate'),2)){
				
				return false;
			}
	}

	if(document.frm_payment.shippostcode.value == ""){
	    document.frm_payment.shippostcode.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Shipping Postal Code ";
		rtnVal = false;
	}
	else{
	    document.frm_payment.shippostcode.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('shippostcode'),3)){
				
				return false;
			}
	}

	
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_payment.submit();		

}

function tourlangvalidation()
{
	rtnVal = true;
	rtnFields = "";
	if(document.frm_langtour.tour_name.value == ""){
	    document.frm_langtour.tour_name.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Tour Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_langtour.tour_name.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('tour_name'),3)){
				
				return false;
			}
	}
	 
	if(document.frm_langtour.tour_shr_desc.value == ""){
	    document.frm_langtour.tour_shr_desc.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Tour Short Description, ";
		rtnVal = false;
	}
	else{
	    document.frm_langtour.tour_shr_desc.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('tour_shr_desc'),3)){			
				return false;
		}
	}
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_langtour.submit();	
}



function edittourvalidation()
{
	rtnVal = true;
	rtnFields = "";
	 
	
 if(document.frm_tour.tour_name.value == ""){
	    document.frm_tour.tour_name.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Tour Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_tour.tour_name.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('tour_name'),3)){
				
				return false;
			}
	}
	if(document.frm_tour.category_name.value == ""){
	    document.frm_tour.category_name.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Category Name, ";
		rtnVal = false;
	}
	

    
	if(document.frm_tour.tour_shr_desc.value == ""){
	    document.frm_tour.tour_shr_desc.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Tour Short Description, ";
		rtnVal = false;
	}
	else{
	    document.frm_tour.tour_shr_desc.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('tour_shr_desc'),3)){
				
				return false;
			}
	}

	if(document.frm_tour.tour_img.value != ""){
	  if(!getFileExtension(document.frm_tour.tour_img.value))
		 {
		  rtnFields = rtnFields + "File extension is not valid, ";	 
	      rtnVal = false; 
		 }
	}

	if(document.frm_tour.ibook_code.value == ""){
	    document.frm_tour.ibook_code.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Ibook Code, ";
		rtnVal = false;
	}
	else{
	    document.frm_tour.ibook_code.style.backgroundColor="White";	
		if(! validateOnlyNumericals(document.getElementById('ibook_code'))){
				
				return false;
			}
	}
	
   	if(document.frm_tour.tour_video.value!= ""){
	    if(!getFileExtensionVideo(document.frm_tour.tour_video.value))
		 {
		  rtnFields = rtnFields + "File extension is not valid, ";	 
	      rtnVal = false; 
		 }
	}
	
	if(document.frm_tour.tour_price.value == ""){
	    document.frm_tour.tour_price.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Tour Price ";
		rtnVal = false;
	}
	
	
	
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_tour.submit();
	
}


function checkRadio(checkvalue) {
var error = "";
   if (!(checkvalue)) {
       error = "Language,";
    }
return error;    
}

function catlangvalidation()
{
	rtnVal = true;
	rtnFields = "";
	for (i=0, n=document.frm_langcategory.lang.length; i<n; i++) {
		if (document.frm_langcategory.lang[i].checked) {
			var checkvalue = document.frm_langcategory.lang[i].value;
			break;		
		} 	
	}
	rtnFields = rtnFields + checkRadio(checkvalue);	
	if(document.frm_langcategory.categoryname.value == ""){
	    document.frm_langcategory.categoryname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Category Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_langcategory.categoryname.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('categoryname'),3)){
				
				return false;
			}
	}	
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_langcategory.submit();
}	



// AJAX ****

function GetXmlHttpObject() {
   var xmlHttp=null;
		var versions = ["Msxml2.XMLHTTP.7.0","Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];

   for(var i=0; i<= versions.length; i++) {
		try	{
			xmlHttp=new XMLHttpRequest();
			return xmlHttp;
		}
		catch(e) {
			try	{
				xmlHttp = new ActiveXObject(versions[i]);
				return xmlHttp;
			}
			catch(e) {
				continue;
			}
		}
	}
	return true;
}

// Add products Tree Structure : getSelectedCategoryTrail : event set in tree.php & tree.js
function getSelectedCategoryTrail(cat_id) {
	if(cat_id=='')
		return '';
	xmlHttp=GetXmlHttpObject();
	var url;
	url="get_combo.php?getCategoryTrail="+cat_id;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
	function stateChanged()	{
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == "completed") {
			// alert(xmlHttp.responseText);
			Object('selectedcategoryDIV').innerHTML = '';
			Object('selectedcategoryDIV').innerHTML = "Your Selected Category :<br><strong>" + xmlHttp.responseText+"</strong>";
			Object('selectedcategoryid_notnull').value = cat_id;
		}
	}
}

function getState(number, id, nextid) {
	xmlHttp=GetXmlHttpObject();
	var url;
	if(number=='')
		return false;

	url="get_combo.php?country="+number;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);

	function stateChanged()	{
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == "completed") {
			// alert(xmlHttp.responseText);
			if(navigator.appName=="Netscape")
				Object(id).innerHTML = xmlHttp.responseText;
			else {
				Object(id+'ID').innerHTML = '';
				if(typeof nextid != 'undefined')
					Object(id+'ID').innerHTML = '<select name="'+id+'" id="'+id+'"  onchange="javascript:getCity(this.value,'+nextid+');"  class="state_select">'+xmlHttp.responseText+'</select>';
			}
		}
	}
	return true;
}

function getCity(number, id, nextid) {
	xmlHttp=GetXmlHttpObject();
	var url;
	if(number=='')
		return false;

	url="get_combo.php?state="+number;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);

	function stateChanged()	{
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == "completed") {
			// alert(xmlHttp.responseText);
			if(navigator.appName=="Netscape")
				Object(myid).innerHTML = xmlHttp.responseText;
			else {
				Object(id+'ID').innerHTML = '';
				if(typeof nextid != 'undefined')
					Object(id+'ID').innerHTML = '<select name="'+id+'" id="'+id+'"  class="state_select">'+xmlHttp.responseText+'</select>';
			}
		}
	}
	return true;
}

function countchars(ele, id, chars)
{
	var cur_chars = Object(ele).value.length;
	// alert(Object(ele).value.charCodeAt(cur_chars-1));
	if(Object(ele).value.charCodeAt(cur_chars-1)==13)
	{
		var text = Object(ele).value;
		// alert(text);
		Object(ele).value = text+'~';
		return ;
	}
	if(cur_chars == chars){
		return false;
	}
	else{
		var remaining = chars - cur_chars;
		if(remaining < 0)
			Object(id).innerHTML = 'You entered more than '+chars+' characters. Please, remove'+remaining * -1+' characters.';
		else
			Object(id).innerHTML = remaining + ' Characters Left';
	}
	return false;
}

function HideShowBlocks(array, id, arrayIMGID, arrayIMG, arrayIMGOV) {
	for(i=1; i<=array.length; i++) {
		if(typeof(array[i])=='undefined')
			continue;

		if(i!=id) {
		   if(typeof(arrayIMG)=='array' && typeof(arrayIMGOV)=='array' && typeof(arrayIMGID)=='array')
				Object(arrayIMGID[i]).src = arrayIMG[i];
			Object(array[i]).style.display = "none";
		}
		else {
		   if(typeof(arrayIMG)=='array' && typeof(arrayIMGOV)=='array' && typeof(arrayIMGID)=='array')
				Object(arrayIMGID[i]).src = arrayIMGOV[i];
			Object(array[i]).style.display = "block";
		}
	}
}

function addasbuddy(alias, url, nmbr) {
	if(alias=='')
		return false;

	xmlHttp=GetXmlHttpObject();

	xmlHttp.onreadystatechange=stateChanged;
	if(nmbr=='1')
		newurl = url+'buddy='+alias;
	else
		newurl = url+'unbuddy='+alias;
	xmlHttp.open("GET", newurl, true);
	xmlHttp.send(null);

	function stateChanged()	{
		if(xmlHttp.readyState == 4 || xmlHttp.readyState == "completed") {
			alert(xmlHttp.responseText);			
			if(nmbr=='2') {
				$str = '<a style="cursor:pointer;" onclick="javascript:addasbuddy(\''+alias+'\', \''+url+'\',\'1\');" class="tahoma_11white">ADD BUDDY</a>';
			}
			else {
				$str = '<a style="cursor:pointer;" onclick="javascript:addasbuddy(\''+alias+'\', \''+url+'\',\'2\');" class="tahoma_11white">UNBUDDY</a>';			
			}
			Object('addbuddyunduddy').innerHTML = $str;
		}
	}
}

function getTDHeight(startEleID, endEleID) {
	contentTop 		= getPixelsFromTop(Object(startEleID))
	contentBottom 	= getPixelsFromTop(Object(endEleID))
	return (parseInt(contentBottom) - parseInt(contentTop));
}

function getPixelsFromTop(obj) {
	objFromTop = obj.offsetTop;
	while(obj.offsetParent!=null) {
		objParent = obj.offsetParent;
		objFromTop += objParent.offsetTop;
		obj = objParent;
	}
	return objFromTop;
}

function emailValidator(elem, helperMsg) {
	var emailExp = /^([a-zA-Z0-9])(([a-zA-Z0-9])*([\._-])?([a-zA-Z0-9]))*@(([a-zA-Z0-9\-])+(\.))+([a-zA-Z]{2,4})+$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function redirect(url) {
	window.location = url;
}

function confmsg()
{
	var confrm = confirm("Are You sure you want to Delete?");
	if(confrm)
		return true;
	else
		return false;
}
function confmsg1()
{
	var confrm = confirm("The selected categories AND any products in them will be removed permanently. Are you sure?");
	if(confrm)
		return true;
	else
		return false;
}



function cmsvalidation()
{
	rtnVal = true;
	rtnFields = "";

if(document.frm_cms.pagename.value == ""){
	    document.frm_cms.pagename.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Page Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_cms.pagename.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('pagename'),3)){
				
				return false;
			}
	}
	if (typeof(FCKeditorAPI)!=='undefined') {
		rtnFields = rtnFields + "Page Content";
	} 
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_cms.submit();

}
function stuffvalidation()
{
	rtnVal = true;
	rtnFields = "";

if(document.frm_cms.stuffname.value == ""){
	    document.frm_cms.pagename.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Stuff Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_cms.pagename.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('stuffname'),3)){
				
				return false;
			}
	}
	if (typeof(FCKeditorAPI)!=='undefined') {
		rtnFields = rtnFields + "Stuff Content";
	} 
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_cms.submit();

}

function toggle(id)
{
   if(document.getElementById(id).style.display=="none")
	{
		document.getElementById(id).style.display="block";	
	}
	else if(document.getElementById(id).style.display=="block")
	{
    	document.getElementById(id).style.display="none";	
	}
}

function validatemember()
{
		rtnVal = true;
	rtnFields = "";

	if(document.frm_member.firstname.value == ""){
	    document.frm_member.firstname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "First Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.firstname.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('firstname'),3)){
				
				return false;
			}
	}
	
	if(document.frm_member.lastname.value == ""){
	    document.frm_member.lastname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Last Name, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.lastname.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('lastname'),3)){
				
				return false;
			}
	}
	
	if(document.frm_member.emailid.value == ""){
	    document.frm_member.emailid.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Email Id, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.emailid.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('Email Id'),3)){
				
				return false;
			}
	}
	if(document.frm_member.add1.value == ""){
	    document.frm_member.add1.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Address1, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.add1.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('add1'),3)){
				
				return false;
			}
	}
	if(document.frm_member.add2.value == ""){
	    document.frm_member.add2.style.backgroundColor="Khaki";
		rtnFields = rtnFields + "Address2, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.add2.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('add2'),3)){
				
				return false;
			}
	}
	if(document.frm_member.suburb.value == ""){
	    document.frm_member.suburb.style.backgroundColor="Khaki";
		rtnFields = rtnFields + " Suburb, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.suburb.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('suburb'),3)){
				
				return false;
			}
	}
	if(document.frm_member.postcode.value == ""){
	    document.frm_member.postcode.style.backgroundColor="Khaki";
		rtnFields = rtnFields + " Postcode, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.postcode.style.backgroundColor="White";	
		if(validateOnlyNumericals(document.getElementById('postcode'))){
			rtnFields = rtnFields + " Post code must be in numbers, ";	
			rtnVal = false;
			}
	}
	if(document.frm_member.consultantname.value == ""){
	    document.frm_member.consultantname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + " Consultant name, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.consultantname.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('consultantname'),3)){
				
				return false;
			}
	}
	if(document.frm_member.consultantsurname.value == ""){
	    document.frm_member.consultantsurname.style.backgroundColor="Khaki";
		rtnFields = rtnFields + " Consultant Surname, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.consultantsurname.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('consultantsurname'),3)){
				
				return false;
			}
	}
	
	if(document.getElementById("party").style.display=="block")
	{	
	
	if(document.frm_member.partystate.value == ""){
	    document.frm_member.partystate.style.backgroundColor="Khaki";
		rtnFields = rtnFields + " Party State, ";
		rtnVal = false;
	}
	else{
	    document.frm_member.partystate.style.backgroundColor="White";	
		if(! lengthRestriction(document.getElementById('partystate'),3)){
				
				return false;
			}
	}
	
	
	
	
	}

	
	if(rtnVal == false)
	{
		alert("Fields Empty :->  " + rtnFields);
		return false;
	}
	document.frm_member.submit();	
}






