function check_add_comment(frm)
{
	if(isNull(frm.gal_comment_content.value))
	{
		Sexy.alert("Please insert comments.");
		return false;
	}
}
function check_link_submit(frm)
{
	var error=false;
	var errormsg="Following error(s) found:";
	var email=frm.link_author_email.value;
	var url=frm.link_url.value;
	var validURL=isValidURL(url.trim());
	var br=new_line();
	if(isNull(frm.link_addedby.value))
	{
		errormsg+= br+"Please enter your name.";
		error=true;
	}
	if(isNull(email))
	{
		errormsg+= br+"Please enter your email-ID.";
		error=true;
	}
	if(!isNull(email) && (!email_check(email)))
	{
		errormsg+= br+"Please enter valid email-ID.";
		error=true;
	}
	if(isNull(url))
	{
		errormsg+= br+"Please enter URL.";
		error=true;
	}
	if(!isNull(url) && validURL!=true)
	{
		errormsg+= br+validURL;
		error=true;
	}
	if(isNull(frm.link_title.value))
	{
		errormsg+= br+"Please enter title.";
		error=true;
	}
	if(isNull(frm.link_description.value))
	{
		errormsg+= br+"Please enter your description.";
		error=true;
	}
	
	if(error)
	{
		Sexy.alert(errormsg);
		return false;
	}
	return true;
}
function new_line()
{
	return "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
}
// Change the value of the outputText field
      
	  function setBanner()
	  {
		 
		 if(httpObject.readyState == 4)
		  {
			  //alert(httpObject.responseText);
			  document.getElementById('banners').innerHTML = httpObject.responseText;
			  
		  }
      }
	 
	  // Implement business logic
      function set_banner_by_countries_id(search_countries_id, search_countries_name)
	  {
      	
		httpObject = getHTTPObject();
		if (httpObject != null) 
		{
			httpObject.open("GET", "ajaxindexconnection.php?set_banner=set_banner&search_countries_id="+search_countries_id, true);
			httpObject.send(null);
			httpObject.onreadystatechange = setBanner;
		}
     }
	 /////////
	 
	 

function showAdsense()
{
 
 if(httpObject.readyState == 4)
  {
	  //alert(httpObject.responseText);
	  document.getElementById('adsense').innerHTML = httpObject.responseText;
	  alert(document.getElementById('adsense').innerHTML);
	  
  }
}
// Implement business logic
function setAdsense(search_countries_id, search_countries_name)
{
	httpObject = getHTTPObject();
	if (httpObject != null) 
	{
		httpObject.open("GET", "ajaxindexconnection.php?set_adsense=set_adsense&search_countries_id="+search_countries_id, true);
		httpObject.send(null);
		httpObject.onreadystatechange = showAdsense;
	}
}
function setByCountryId(search_countries_id, search_countries_name)
{
	set_banner_by_countries_id(search_countries_id, search_countries_name);
	setAdsense(search_countries_id, search_countries_name);
}
function setJobTitle(jobTitle)
{
	document.getElementById('txttitle').value=jobTitle;
	setUrl();
}
function increase_view(aff_banner_id)
{
	
	httpObject = getHTTPObject();
	if (httpObject != null) 
	{
		httpObject.open("GET", "include/ajaxindexconnection.php?increase_view=increase_view&aff_banner_id="+aff_banner_id, true);
		httpObject.send(null);
		//alert(aff_banner_id);
	}
}
function setUrl()
{
	var ext='.htm';
	var titlePostFix="jobs";
	var concatOp="-";
	var cityPreFix="in";
	var countryPreFix="in";
	var formAction=""
	var site_url="";
	if(!isNull(document.getElementById('txttitle').value))
	{
		var title=document.getElementById('txttitle').value;
		formAction+=title+concatOp+titlePostFix+concatOp;
	}
	if(!isNull(document.getElementById('txtcity').value))
	{
		var city=document.getElementById('txtcity').value;
		formAction+=cityPreFix+concatOp+city+concatOp;
	}
	if(isNull(formAction))
	{
		Sexy.alert("Please provide search criteria.");
		return false;
	}
	if(!isNull(document.getElementById('country').value))
	{
		var country=document.getElementById('country').value;
		formAction+=countryPreFix+concatOp+country+concatOp;
	}
	if(!isNull(document.getElementById('search_countries_id').value))
	{
		var search_countries_id=document.getElementById('search_countries_id').value;
		formAction+=search_countries_id;
	}
	
	if(document.getElementById('site_url'))
	{
		site_url=document.getElementById('site_url').value;
	}
	formAction+=ext;
	
	searchForm=document.getElementById('formname_search');
	formAction=strReplace(" ","-",site_url+formAction);
	//alert(formAction);
	var preUrl=document.getElementById('url').href;
	formAction=preUrl.replace(site_url, formAction);
	searchForm.action=formAction;
	//alert(formAction);
	//window.location.href=formAction;
	uc=String(self.location);
	if(uc.indexOf("translate_c")<0)
	{
		window.location.href = formAction;
	}
	else
	{
		window.parent.location = formAction;
	}
	//searchForm.submit();
}
