/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Purpose		: Comman javascript function for Poperty show

CFD Path	:

Change History		:

Mod#	 	Date	 		Who   		Description
-------		--------  		------  	---------------------------------
00000001	09 Dec 2008		Amit Goel 	Created

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/

/* function to validate numeric field  -*/

function isNumberKey(evt,enabledot)
{
	if(!enabledot) enabledot=0;
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=46 && enabledot==1)
	return false;
	else if (charCode > 31 && (charCode < 48 || charCode > 57) && enabledot==0)
	return false;
	return true;
}

/* function to validate name(only allow text) field  -*/

function validatesymbolwithspace(formName,fieldName)
{
	var	doc = "document."
	a=eval(doc+formName+"."+fieldName)
	fieldValue=eval(doc+formName+"."+fieldName + ".value")
	chk1 = "!@#$%^*+=|\~`{}[]:;<>?/,1234567890";
	chk3="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(j=0;j!=fieldValue.length;j++)
	{
		ch1= fieldValue.charAt(j);
		ch2= fieldValue.charAt(0);
		rtn1=chk1.indexOf(ch1);
		rtn3=chk3.indexOf(ch2);
		if(rtn3 < 0)
		{
			eval(doc+formName+"."+fieldName + ".focus()")
			return false;
			break;
		}
		else if(rtn1!=-1)
		{
			eval(doc+formName+"."+fieldName + ".focus()")
			return false;
			break;	
		}
	}
	return true;
}

/* function to validate email field  -*/

function isValidEmail(str)
{
	if(!(/^[^a-zA-Z]/.test(str)) && (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(str))) {
		return true
	} else {
		return false
	}
}

/* function to validate form field  -*/

function validate_comman()
{
	document.getElementById('div_contactperson').innerHTML = "";
	document.getElementById('div_mobile').innerHTML = "";
	document.getElementById('div_email').innerHTML = "";

	count_bug=0;
	if(document.frm_kol.contactperson.value=="")
	{
		document.getElementById('div_contactperson').innerHTML = "<img src='"+ALERT_IMG+"' width='8' height='8' align='absmiddle' vspace='3' border=0>&nbsp;Please enter your name.";
		count_bug+=1;

	}
	if(document.frm_kol.contactperson.value.length < "4" )
	{
		document.getElementById('div_contactperson').innerHTML = "<img src='"+ALERT_IMG+"' width='8' height='8' align='absmiddle' vspace='3' border=0>&nbsp;Please enter your full name.";
		count_bug+=1;
	}
	if(validatesymbolwithspace('frm_kol','contactperson','abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890','!@#$%^*+=|\~{}[];<>?/\,()')==false)
	{
		document.getElementById('div_contactperson').innerHTML = "<img src='"+ALERT_IMG+"' width='8' height='8' align='absmiddle' vspace='3' border=0>&nbsp;Please enter your valid name.";
		count_bug+=1;
	}
	if(document.frm_kol.yourmobile.value=="")
	{
		document.getElementById('div_mobile').innerHTML = "<img src='"+ALERT_IMG+"' width='8' height='8' align='absmiddle' vspace='3' border=0>&nbsp;Please enter mobile number.";
		count_bug+=1;
	}
	if(document.frm_kol.yourmobile.value !="" && document.frm_kol.yourmobile.value.length < 10)
	{
		document.getElementById('div_mobile').innerHTML = "<img src='"+ALERT_IMG+"' width='8' height='8' align='absmiddle' vspace='3' border=0>&nbsp;Please enter valid mobile number.";
		count_bug+=1;
	}
	if(isNaN(document.frm_kol.yourmobile.value) && document.frm_kol.yourmobile.value!="" )
	{
		document.getElementById('div_mobile').innerHTML = "<img src='"+ALERT_IMG+"' width='8' height='8' align='absmiddle' vspace='3' border=0>&nbsp;Please enter valid mobile number.";
		count_bug+=1;
	}
	if(document.frm_kol.youremail.value== "" || !isValidEmail(document.frm_kol.youremail.value))
	{
		document.getElementById('div_email').innerHTML = "<img src='"+ALERT_IMG+"' width='8' height='8' align='absmiddle' vspace='3' border=0>&nbsp;Please enter valid email id.";
		count_bug+=1;
	}
	if(count_bug>0)
		return false;
	else
	
	return true;
}

/* function to change the contained and buttom images  -*/

function change_content_kolkatta(val)
	{
		if(val == '1')
		{
			document.getElementById('div_aboutus').style.display = '';
			document.getElementById('div_sitelayout').style.display = 'none'
			document.getElementById('div_enquiries').style.display = 'none'
			document.getElementById('image1').src = ""+IMG_SERVER+"/images/ps/kolkata/about-act.gif";
			document.getElementById('image2').src = ""+IMG_SERVER+"/images/ps/kolkata/show-inactive.gif";
			document.getElementById('image3').src = ""+IMG_SERVER+"/images/ps/kolkata/stall-inactive.gif";

		}else if(val == '2')
		{
			document.getElementById('div_aboutus').style.display = 'none';
			document.getElementById('div_enquiries').style.display = 'none'
			document.getElementById('div_sitelayout').style.display = '';
			document.getElementById('image1').src = ""+IMG_SERVER+"/images/ps/kolkata/about-inact.gif";
			document.getElementById('image2').src = ""+IMG_SERVER+"/images/ps/kolkata/show-active.gif";
			document.getElementById('image3').src = ""+IMG_SERVER+"/images/ps/kolkata/stall-inactive.gif";
			
		}else if(val == '3')
		{
			document.getElementById('div_aboutus').style.display = 'none';
			document.getElementById('div_sitelayout').style.display = 'none';
			document.getElementById('div_enquiries').style.display = ''
			document.getElementById('image1').src = ""+IMG_SERVER+"/images/ps/kolkata/about-inact.gif";
			document.getElementById('image2').src = ""+IMG_SERVER+"/images/ps/kolkata/show-inactive.gif";
			document.getElementById('image3').src = ""+IMG_SERVER+"/images/ps/kolkata/stall-active.gif";
		}
	}
