function check_adminreg()
{
if(document.adminreg.name.value=='')
	{
			alert("Please Select Name");
			document.adminreg.name.focus();
			return false;
	}
if(document.getElementById("lblmsg"))
{
	if(document.getElementById("lblmsg").innerHTML!= '')
	{
		alert("Please Select Another Name");
		return false;
	}
}
	
if(document.adminreg.password.value=='')
	{
			alert("Please Select Password");
			document.adminreg.password.focus();
			return false;
	}	
if (document.adminreg.level){
	if (document.adminreg.level.value=='')
		{
			alert("Please Select Level");
			document.adminreg.level.focus();
			return false;
		}
	}	
}

function go_to()
{
id = document.getElementById('ad_id').value;	
if (id)
{
	if (isInteger(id))
	{
//admin/cone_qcform.php?id=4180526
		//window.location="http://www.classifiedone.com/admin/cone_qcform.php?id="+id;
		window.location="http://www.jankiindia.com/admin/cone_qcform.php?id="+id;
	}
}

}

function chk_feedback()
{
if(document.feedback.fname.value =='')
	{
		alert("Please Enter First name");
		document.feedback.fname.focus();
		return false;
	}
if(document.feedback.location.value =='')
	{
		alert("Please Enter Location");
		document.feedback.location.focus();
		return false;
	}
if(document.feedback.email.value =='')
	{
		alert("Please Enter Email");
		document.feedback.email.focus();
		return false;
	}
if(document.feedback.title.value =='')
	{
		alert("Please Enter Title");
		document.feedback.title.focus();
		return false;
	}
if(document.feedback.comments.value =='')
	{
		alert("Please Enter Comment");
		document.feedback.comments.focus();
		return false;
	}	
}

function Chk_Response()
{
if(document.Responseform.comment.value =='')
	{
		alert("Please Enter Comment");
		document.Responseform.comment.focus();
		return false;
	}
if(document.Responseform.name.value =='')
	{
		alert("Please Enter Name");
		document.Responseform.name.focus();
		return false;
	}
if(document.Responseform.email.value =='')
	{
		alert("Please Enter Email");
		document.Responseform.email.focus();
		return false;
	}
if (document.Responseform.email.value && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.Responseform.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.\n\n Example: xyz@domainname.com");
		document.Responseform.email.focus();
		return false;
	}



if(document.Responseform.country1.value =='0')
	{
		alert("Please Select your Country");
		document.Responseform.country1.focus();
		return false;
	}



if(document.Responseform.mobile.value =='')
	{
		alert("Please enter your Phone / Mobile No.");
		document.Responseform.mobile.focus();
		return false;
	}

if ((isInteger(document.Responseform.mobile.value) == false))
		{
			alert("Please Enter a Valid Phone Number.")
			document.Responseform.mobile.value=""
			document.Responseform.mobile.focus();
			return false;
		}





}

function chk_del(id)
{
		var yesno=confirm("Do you really want to delete this Ad.");
		if (yesno == true)
		{
			window.location='manage_ad.php?action=del&id='+id;	
		}
		else
		{
			window.location='manage_ad.php';	
		}	
}

function Chk_login()
{
if(document.login.username.value =='')
	{
		alert("Please Enter Email");
		document.login.username.focus();
		return false;
	}
	if (document.login.username.value && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.login.username.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.\n\n Example: xyz@domainname.com");
		document.login.username.focus();
		return false;
	}
	if(document.login.password.value =='')
	{
		alert("Please Enter Password");
		document.login.password.focus();
		return false;
	}
}

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 Check_Search()
{
	if(document.formSearch.q.value =='Enter Your Keyword here...')
	{
		alert("Please Enter Keyword For Search");
		document.formSearch.q.focus();
		return false;
	}
	var	keyword = document.formSearch.q.value;
	var city = document.formSearch.c.value;

	if (city > 0)
	{
		self.location = 'cone_search.php?q='+keyword+'&c='+city;		
	}
	else
		self.location = 'cone_search.php?q='+keyword;

	return false;
}


function Check_PostAd()
{
	if(document.addform.title.value =='')
	{
		alert("Please Enter Company Name");
		document.addform.title.focus();
		return false;
	}
	if(document.addform.desc.value =='')
	{
		alert("Please Enter Description");
		document.addform.desc.focus();
		return false;
	}	
	var statechoice=document.addform.state.value;
	if (statechoice=='-1')
	{
		alert("Please Select State");
		document.addform.state.focus();
		return false;
	}
	if(document.addform.city)
	{
	var citychoice=document.addform.city.value;
	if (citychoice=='-- Select city --')
	{
		alert("Please Select City");
		document.addform.city.focus();
		return false;
	}
	}
	var catchoice=document.addform.cat.value;
	if (catchoice=='-1')
	{
		alert("Please Select Category");
		document.addform.cat.focus();
		return false;
	}
	if(document.addform.sub_cat)
	{
			var subcatchoice=document.addform.sub_cat.value;
			if (subcatchoice=='-- Select Subcategory --')
			{
				alert("Please Select Sub Category");
				document.addform.sub_cat.focus();
				return false;
			}
	}
}

function Check_EditAd()
{
	if(document.addform.title.value =='')
	{
		alert("Please Enter Company Name");
		document.addform.title.focus();
		return false;
	}
	if(document.addform.desc.value =='')
	{
		alert("Please Enter Description");
		document.addform.desc.focus();
		return false;
	}	
}

function Check_JoinFree()
{
	if(document.joinfree.email.value =='')
	{
		alert("Please Enter Email");
		document.joinfree.email.focus();
		return false;
	}

	/*
	if(document.getElementById("lblmsg"))
	{
		if(document.getElementById("lblmsg").innerHTML!= '')
		{
			alert("Please Select Another Email Id");
			return false;
		}
	}*/

	if (document.joinfree.email.value && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.joinfree.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.\n\n Example: xyz@domainname.com");
		document.joinfree.email.focus();
		return false;
	}
	if(document.joinfree.password.value =='')
	{
		alert("Please Enter Password");
		document.joinfree.password.focus();
		return false;
	}
	if(document.joinfree.name.value =='')
	{
		alert("Please Enter Contact  Name");
			document.joinfree.name.focus();
		return false;
	}
	if(document.joinfree.mobile.value)
	{
		if ((isInteger(document.joinfree.mobile.value) == false))
		{
			alert("Please Enter a Valid Mobile Number.")
			document.joinfree.mobile.value=""
			document.joinfree.mobile.focus();
			return false
		}
		if(document.joinfree.mobile.value.length > 12 || document.joinfree.mobile.value.length <10)
		{
			alert("Please Enter a Valid Mobile Number.")
			document.joinfree.mobile.value=""
			document.joinfree.mobile.focus();
			return false
		}
	}
	
	if(document.joinfree.website.value!='')
	{
			if(document.joinfree.website.value!='http://')
			{		
				var v = new RegExp();
				v.compile("^http://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
				if (!v.test(document.joinfree.website.value)) 
				{
				     alert("Please Enter a valid URL\n and Must start with http://");
					document.joinfree.website.value="";
					document.joinfree.website.value="http://";
					document.joinfree.website.focus();
					return false;
				}
		}
	}


	if(document.joinfree.country1.value =='0')
	{
		alert("Please Select your country");
		document.joinfree.country1.focus();
		return false;
	}	


	if(document.joinfree.mobile.value =='')
	{
		alert("Please Enter your Mobile No.");
		document.joinfree.mobile.focus();
		return false;
	}	

	if(document.joinfree.street.value =='')
	{
		alert("Please Enter Street Address");
		document.joinfree.street.focus();
		return false;
	}	


	if(document.joinfree.city.value =='')
	{
		alert("Please Enter your City");
		document.joinfree.city.focus();
		return false;
	}	




if(document.getElementById("lblmsg").innerHTML=='Email Id Already Exist.')
	{
alert("Email Id Already Exist. Please Use Any Other Email");
document.joinfree.email.focus();
return false;
	}





}

function Check_category()
{
	if(document.catform.catname.value =='')
	{
		alert("Please Enter Categoty Name");
		document.catform.catname.focus();
		return false;
	}
	if(document.catform.catdescription.value =='')
	{
		alert("Please Enter Description");
		return false;
	}

}

function a()
{
	alert ('Called');

}

PositionX = 100;
PositionY = 100;


defaultWidth  = 500;
defaultHeight = 500;

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}

with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
writeln('<sc'+'ript>');
writeln('var isNN,isIE;');
writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');
writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');
writeln('window.resizeTo(300,300);');
writeln('width=300-(document.body.clientWidth-document.images[0].width);');
writeln('height=300-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["ClassifiedOne"].width;');
writeln('window.innerHeight=document.images["ClassifiedOne"].height;}}');

writeln('function doTitle(){document.title="'+imageTitle+'";}');

writeln('</sc'+'ript>');

if (!AutoClose) 
writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else 
writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');

writeln('<img name="ClassifiedOne" src='+imageURL+' style="display:block" alt="'+imageTitle+'"></body></html>');
close();		
}}



function formopen()

{
//alert('a');

if (document.getElementById('f1').style.display=="none")
{
	document.getElementById('f2').style.borderBottom="0px solid #CCB220";

	document.getElementById('f1').style.display="block";
}
else
	{
document.getElementById('f1').style.display="none";
document.getElementById('f2').style.borderBottom="1px solid #CCB220";
	
	}

}


function srcht()
{
if(document.getElementById('srch').value=="Enter Your Keyword here...")
	{
	document.getElementById('srch').value="";
   document.getElementById('srch').className="srch2";
	}
}

function srcht1()
{
if(document.getElementById('srch').value=="")
	{
	document.getElementById('srch').value="Enter Your Keyword here...";
   document.getElementById('srch').className="srch1";
	}
}



function check_count_change()
{
	var val = document.joinfree.country1.options[document.joinfree.country1.selectedIndex].value;
	//alert(val);
	if(val == 0)
	{
		document.joinfree.ph_country1.value='';
		return false;
	}
	//alert(document.joinfree.country_iso.value);
	if(phonecode[document.joinfree.country1.selectedIndex] != '')
	{
		var a = phonecode[document.joinfree.country1.selectedIndex].split("-");
		document.joinfree.countrycode.value = '+'+a[0];
		document.joinfree.countrycode1.value = '+'+a[0];
	}
//	document.joinfree.country_iso.value = val;
document.joinfree.country.value = document.joinfree.country1.options[document.joinfree.country1.selectedIndex].text;
}

 

 function check_count_change1()
{
	var val = document.Responseform.country1.options[document.Responseform.country1.selectedIndex].value;
	if(val == 0)
	{
		document.Responseform.ph_country1.value='';
		return false;
	}			

	//alert(document.Responseform.country_iso.value);
	if(phonecode[document.Responseform.country1.selectedIndex] != '')
	{
		var a = phonecode[document.Responseform.country1.selectedIndex].split("-");
		document.Responseform.countrycode.value = '+'+a[0];


	}
//	document.Responseform.country_iso.value = val;
document.Responseform.country.value = document.Responseform.country1.options[document.Responseform.country1.selectedIndex].text;
}



function Check_PostAdvance()
{
	if(document.addform.title.value =='')
	{
		alert("Please Enter Company Name");
		document.addform.title.focus();
		return false;
	}
	if(document.addform.desc.value =='')
	{
		alert("Please Enter Description");
		document.addform.desc.focus();
		return false;
	}	


	if(document.addform.prd_profile.value =='')
	{
		alert("Please Enter Product Profile");
		document.addform.prd_profile.focus();
		return false;
	}	
	
	

	if(document.addform.email.value =='')
	{
		alert("Please Enter User Email");
		document.addform.email.focus();
		return false;
	}


		if(document.addform.name.value =='')
	{
		alert("Please Enter Contact Name");
		document.addform.name.focus();
		return false;
	}


		if(document.addform.country1.value =='0')
	{
		alert("Please Select Country Name");
		document.addform.country1.focus();
		return false;
	}

		if(document.addform.mobile.value =='')
	{
		alert("Please Enter Mobile No.");
		document.addform.mobile.focus();
		return false;
	}

		if(document.addform.website.value =='')
	{
		alert("Please Enter Website");
		document.addform.website.focus();
		return false;
	}
		if(document.addform.street.value =='')
	{
		alert("Please Enter street address");
		document.addform.street.focus();
		return false;
	}
		if(document.addform.city.value =='')
	{
		alert("Please Enter city");
		document.addform.city.focus();
		return false;
	}

			if(document.addform.state.value =='')
	{
		alert("Please Enter state");
		document.addform.state.focus();
		return false;
	}


}



function check_count_change2()
{
	var val = document.addform.country1.options[document.addform.country1.selectedIndex].value;
	//alert(val);
	if(val == 0)
	{
		document.addform.ph_country1.value='';
		return false;
	}
	//alert(document.addform.country_iso.value);
	if(phonecode[document.addform.country1.selectedIndex] != '')
	{
		var a = phonecode[document.addform.country1.selectedIndex].split("-");
		document.addform.countrycode.value = '+'+a[0];
		document.addform.countrycode1.value = '+'+a[0];
	}
//	document.addform.country_iso.value = val;
document.addform.country.value = document.addform.country1.options[document.addform.country1.selectedIndex].text;
}

var newwindow;
function poptastic(url)
{
	newwindow=window.open(url,'name','height=300,width=300');
	if (window.focus) {newwindow.focus()}
}




function Chk_Response11()
{

if(document.Responseform1.company.value =='')
	{
		alert("Please Enter Name");
		document.Responseform1.company.focus();
		return false;
	}

if(document.Responseform1.name.value =='')
	{
		alert("Please Enter Name");
		document.Responseform1.name.focus();
		return false;
	}




if(document.Responseform1.email.value =='')
	{
		alert("Please Enter Email");
		document.Responseform1.email.focus();
		return false;
	}


if (document.Responseform1.email.value && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.Responseform1.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.\n\n Example: xyz@domainname.com");
		document.Responseform1.email.focus();
		return false;
	}



if(document.Responseform1.phone.value =='')
	{
		alert("Please Enter Email");
		document.Responseform1.phone.focus();
		return false;
	}


}




function check_count_change5()
{
	var val = document.addform.country1.options[document.addform.country1.selectedIndex].value;
	//alert(val);
	if(val == 0)
	{
		document.addform.ad_user_countrycode.value='';
		return false;
	}
	//alert(document.addform.country_iso.value);
	if(phonecode[document.addform.country1.selectedIndex] != '')
	{
		var a = phonecode[document.addform.country1.selectedIndex].split("-");
		document.addform.ad_user_countrycode.value = '+'+a[0];
	}
//	document.addform.country_iso.value = val;
document.addform.ad_user_country.value = document.addform.country1.options[document.addform.country1.selectedIndex].text;
}
