//general functions to be included on all pages

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);
}

function popupmail(id)
   {
	window.open('mail_contact_form.php?to_id='+id,'SEND','scrollbars=yes,width=540,height=590');
   }

function PopUp_Poll2(poll_id){
		if(window.document.voteform.option_id[0].checked==false){													if(window.document.voteform.option_id[1].checked==false){
				alert("Please select at least one poll option.");
				return false;
			}
		}
	}
	function search(){
		document.frmsearch.search.value='';
	}
	function PopUp_Poll(poll_id){
		if(window.document.frm_poll.poll_rad[0].checked==false){
			if(window.document.frm_poll.poll_rad[1].checked==false){
				alert("Please select at least one poll option.");
				return false;
			}
		}

		if(window.document.frm_poll.poll_rad[0].checked==true){
		option_id=1;
		}
		else{
		option_id=2;
		}
		window.location.href="http://www.hotelresortinsider.com/daily_poll/index.php?action=vote&poll_ident="+poll_id+"&option_id="+option_id;

		return false;
	}

function popup(news_id){
		MM_openBrWindow('comment_news.php?news_id='+news_id,'Comment','scrollbars=yes,status=yes,resizable=no,width=645,height=675')
	}
			
	function popprint(news_id){
		MM_openBrWindow('printable_news.php?news_id='+news_id,'Comment','scrollbars=yes,width=615,height=450')
	}
	function popmail(news_id){
	MM_openBrWindow('mail_vision.php?news_id='+news_id,'Comment','scrollbars=yes,resizeable=no,width=600,height=600')
	}

//********************************general functions end************************************

//*************************************functions for lookout table start***************************
function changeimg1(){
  document.getElementById("img2").src="http://www.hotelresortinsider.com/images/discount-1.gif";
  document.getElementById("img3").src="http://www.hotelresortinsider.com/images/jobs-1.gif";
  document.getElementById("img4").src="http://www.hotelresortinsider.com/images/fam-1.gif";
//alert(document.getElementById("img1").src.indexOf("images/breaking-news.gif"));
 if(document.getElementById("img1").src.indexOf("http://www.hotelresortinsider.com/images/specials.gif")!="-1"){
  document.getElementById("img1").src="http://www.hotelresortinsider.com/images/specials.gif";
 }else{
  document.getElementById("img1").src="http://www.hotelresortinsider.com/images/specials.gif";
 }
}
function changeimg2(){
  document.getElementById("img1").src="http://www.hotelresortinsider.com/images/images/special-1.gif";
  document.getElementById("img3").src="http://www.hotelresortinsider.com/images/images/jobs-1.gif";
  document.getElementById("img4").src="http://www.hotelresortinsider.com/images/images/fam-1.gif";
 if(document.getElementById("img2").src.indexOf("http://www.hotelresortinsider.com/images/images/discount-2.gif")!="-1"){
  document.getElementById("img2").src="http://www.hotelresortinsider.com/images/images/discount-2.gif";
 }else{
  document.getElementById("img2").src="http://www.hotelresortinsider.com/images/images/discount-2.gif";
 }
}
function changeimg3(){
  document.getElementById("img1").src="http://www.hotelresortinsider.com/images/special-1.gif";
  document.getElementById("img2").src="http://www.hotelresortinsider.com/images/discount-1.gif";
  document.getElementById("img4").src="http://www.hotelresortinsider.com/images/fam-1.gif";
 if(document.getElementById("img3").src.indexOf("http://www.hotelresortinsider.com/images/jobs-2.gif")!="-1"){
  document.getElementById("img3").src="http://www.hotelresortinsider.com/images/jobs-2.gif";
 }else{
  document.getElementById("img3").src="http://www.hotelresortinsider.com/images/jobs-2.gif";
 }
}
function changeimg4(){
  document.getElementById("img1").src="http://www.hotelresortinsider.com/images/special-1.gif";
  document.getElementById("img2").src="http://www.hotelresortinsider.com/images/discount-1.gif";
  document.getElementById("img3").src="http://www.hotelresortinsider.com/images/jobs-1.gif";
 if(document.getElementById("img4").src.indexOf("http://www.hotelresortinsider.com/images/fam-2.gif")!="-1"){alert("neha");
  document.getElementById("img4").src="http://www.hotelresortinsider.com/images/fam-2.gif";
 }else{
  document.getElementById("img4").src="http://www.hotelresortinsider.com/images/fam-2.gif";
 }
}

function callajax(typeid,typeurl){
	
	if (typeurl==2)
	{
		var hgt="100px";
		var hgtload="0px";
		if (typeid==1){
			document.getElementById("img2").src="http://www.hotelresortinsider.com/images/discount-1.gif";
			document.getElementById("img3").src="http://www.hotelresortinsider.com/images/jobs-1.gif";
			document.getElementById("img4").src="http://www.hotelresortinsider.com/images/fam-1.gif";
			path1="http://www.hotelresortinsider.com/images/specials.gif";
			path2="http://www.hotelresortinsider.com/images/special-1.gif";
		}
		if (typeid==2){
			document.getElementById("img1").src="http://www.hotelresortinsider.com/images/special-1.gif";
			document.getElementById("img3").src="http://www.hotelresortinsider.com/images/jobs-1.gif";
			document.getElementById("img4").src="http://www.hotelresortinsider.com/images/fam-1.gif";
			path1="http://www.hotelresortinsider.com/images/discount.gif";
			path2="http://www.hotelresortinsider.com/images/discount-2.gif";
		}
		if (typeid==3){
			document.getElementById("img1").src="http://www.hotelresortinsider.com/images/special-1.gif";
			document.getElementById("img2").src="http://www.hotelresortinsider.com/images/discount-1.gif";
			document.getElementById("img4").src="http://www.hotelresortinsider.com/images/fam-1.gif";
			path1="http://www.hotelresortinsider.com/images/jobs.gif";
			path2="http://www.hotelresortinsider.com/images/jobs-2.gif";
		}
		if (typeid==4){
			document.getElementById("img1").src="http://www.hotelresortinsider.com/images/special-1.gif";
			document.getElementById("img2").src="http://www.hotelresortinsider.com/images/discount-1.gif";
			document.getElementById("img3").src="http://www.hotelresortinsider.com/images/jobs-1.gif";
			path1="http://www.hotelresortinsider.com/images/fam.gif";
			path2="http://www.hotelresortinsider.com/images/fam-2.gif";
		}
		 document.getElementById("img"+typeid).src=path1;
	}
	if (typeurl==1)
	{var hgt="75px";
		var hgtload="00px";
		if (typeid==1){
			document.getElementById("img2").src="http://www.hotelresortinsider.com/images/discount-1.gif";
			document.getElementById("img3").src="http://www.hotelresortinsider.com/images/jobs-1.gif";
			document.getElementById("img4").src="http://www.hotelresortinsider.com/images/fam-1.gif";
			path1="http://www.hotelresortinsider.com/images/specials.gif";
			path2="http://www.hotelresortinsider.com/images/specials.gif";
		}
		if (typeid==2){
			document.getElementById("img1").src="images/special-1.gif";
			document.getElementById("img3").src="images/job-1.gif";
			document.getElementById("img4").src="images/fam-1.gif";
			path1="http://www.hotelresortinsider.com/images/discount.gif";
			path2="http://www.hotelresortinsider.com/images/discount.gif";
		}
		if (typeid==3){
			document.getElementById("img1").src="http://www.hotelresortinsider.com/images/special-1.gif";
			document.getElementById("img3").src="images/jobs-1.gif";
			document.getElementById("img4").src="images/fam-1.gif";
			path1="http://www.hotelresortinsider.com/images/jobs.gif";
			path2="http://www.hotelresortinsider.com/images/jobs.gif";
		}
		if (typeid==4){
			document.getElementById("img1").src="http://www.hotelresortinsider.com/images/special-1.gif";
			document.getElementById("img2").src="http://www.hotelresortinsider.com/images/discount-1.gif";
			document.getElementById("img3").src="http://www.hotelresortinsider.com/images/job-1.gif";
			path1="http://www.hotelresortinsider.com/images/fam.gif";
			path2="http://www.hotelresortinsider.com/images/fam.gif";
		}
		 document.getElementById("img"+typeid).src=path1;
	}
	document.getElementById('NewsContent').innerHTML = "<table align=center><tr><td valign=top style='padding-top:"+hgt+"'><img src='http://www.hotelresortinsider.com/images/images/loading_circle.gif'></td></tr><tr><td valign=middle style='padding-top:0px;'><font style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; text-transform: capitalize; color: #999999;';>LOADING...</font></td></tr></table>";

	var ajaxRequest; 
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('NewsContent');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}

	var queryString1 = "typeid=" + typeid +"&typeurl="+typeurl;
	
	ajaxRequest.open("GET", "ajax-listing.php?" + queryString1, true);
	ajaxRequest.send(null); 
}


function blue1(imgid){
	
	if (imgid==1)
	{
		path1="http://www.hotelresortinsider.com/images/special-2.gif";
		path2="http://www.hotelresortinsider.com/images/special-2.gif";
		click_img="http://www.hotelresortinsider.com/images/specials.gif";
	}
	if (imgid==2)
	{
		path1="http://www.hotelresortinsider.com/images/discount-2.gif";
		path2="http://www.hotelresortinsider.com/images/discount-2.gif";
		click_img="http://www.hotelresortinsider.com/images/discount.gif";
	}
	if (imgid==3)
	{
		path1="http://www.hotelresortinsider.com/images/jobs-2.gif";
		path2="http://www.hotelresortinsider.com/images/jobs-2.gif";
		click_img="http://www.hotelresortinsider.com/images/jobs.gif";
	}
	if (imgid==4)
	{
		path1="http://www.hotelresortinsider.com/images/fam-2.gif";
		path2="http://www.hotelresortinsider.com/images/fam-2.gif";
		click_img="http://www.hotelresortinsider.com/images/fam.gif";
	}
//	alert(document.getElementById("img"+imgid).src.indexOf(click_img));
	if(document.getElementById("img"+imgid).src.indexOf(click_img)=="-1"){	
		if(document.getElementById("img"+imgid).src.indexOf(path1)!="-1"){
		  document.getElementById("img"+imgid).src=path1;
		 }else{
		  document.getElementById("img"+imgid).src=path2;
		 }
	}else{
		document.getElementById("img"+imgid).src=click_img;
	}
}
function blue2(imgid){
	
	if (imgid==1)
	{
		path1="http://www.hotelresortinsider.com/images/special-1.gif";
		path2="http://www.hotelresortinsider.com/images/special1.gif";
	}
	if (imgid==2)
	{
		path1="http://www.hotelresortinsider.com/images/discount-2.gif";
		path2="http://www.hotelresortinsider.com/images/discount-2.gif";
	}
	if (imgid==3)
	{
		path1="http://www.hotelresortinsider.com/images/jobs-1.gif";
		path2="http://www.hotelresortinsider.com/images/jobs-1.gif";
	}
	if (imgid==4)
	{
		path1="http://www.hotelresortinsider.com/images/fam-2.gif";
		path2="http://www.hotelresortinsider.com/images/fam-2.gif";
	}
	
	if(document.getElementById("img"+imgid).src.indexOf(path1)!="-1"){
	  document.getElementById("img"+imgid).src=path1;
	 }else{
	  document.getElementById("img"+imgid).src=path2;
	 }
}

function black1(imgid){
	
	if (imgid==1)
	{
		path1="http://www.hotelresortinsider.com/images/special-1.gif";
		path2="http://www.hotelresortinsider.com/images/special-1.gif";
		click_img="http://www.hotelresortinsider.com/images/specials.gif";
	}
	if (imgid==2)
	{
		path1="http://www.hotelresortinsider.com/images/discount-1.gif";
		path2="http://www.hotelresortinsider.com/images/discount-1.gif";
		click_img="http://www.hotelresortinsider.com/images/discount.gif";
	}
	if (imgid==3)
	{
		path1="http://www.hotelresortinsider.com/images/jobs-1.gif";
		path2="http://www.hotelresortinsider.com/images/jobs-1.gif";
		click_img="http://www.hotelresortinsider.com/images/jobs.gif";
	}
	if (imgid==4)
	{
		path1="http://www.hotelresortinsider.com/images/fam-1.gif";
		path2="http://www.hotelresortinsider.com/images/fam-1.gif";
		click_img="http://www.hotelresortinsider.com/images/fam.gif";
	}
	
	if(document.getElementById("img"+imgid).src.indexOf(click_img)=="-1"){	
		if(document.getElementById("img"+imgid).src.indexOf(path1)!="-1"){
			document.getElementById("img"+imgid).src=path1;
		}else{
			document.getElementById("img"+imgid).src=path2;
		}
	}else{
		document.getElementById("img"+imgid).src=click_img;
	}
}
function black2(imgid){
	
	if (imgid==1)
	{
		path1="http://www.hotelresortinsider.com/images/specials.gif";
		path2="http://www.hotelresortinsider.com/images/specials.gif";
	}
	if (imgid==2)
	{
		path1="http://www.hotelresortinsider.com/images/discount.gif";
		path2="http://www.hotelresortinsider.com/images/discount.gif";
	}
	if (imgid==3)
	{
		path1="http://www.hotelresortinsider.com/images/jobs.gif";
		path2="http://www.hotelresortinsider.com/images/jobs.gif";
	}
	if (imgid==4)
	{
		path1="http://www.hotelresortinsider.com/images/fam.gif";
		path2="http://www.hotelresortinsider.com/images/fam.gif";
	}
	if(document.getElementById("img"+imgid).src.indexOf(path1)!="-1"){
	document.getElementById("img"+imgid).src=path1;
	}else{
	document.getElementById("img"+imgid).src=path2;
	}
}
//*************************************functions for lookout table end***************************

function ajaxmore(intval,news_cat){
	document.getElementById('ajaxmorenews').innerHTML = "<table border='0'><tr><td align=left valign=middle style='padding-top:150px;padding-left:124px;'><img src='images/loading_circle.gif'></td></tr><tr><td valign=middle style='padding-top:0px;padding-left:120px;'><font style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; text-transform: capitalize; color: #999999;';>LOADING...</font></td></tr></table>";
	var ajaxRequest; 
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
		//	alert(ajaxRequest.responseText);
			var ajaxDisplay = document.getElementById('ajaxmorenews');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	var queryString1 = "int_val=" + intval +"&news_cat="+news_cat;
//	alert("ajaxcatnews.php?" + queryString1);
	ajaxRequest.open("GET", "ajaxcatnews.php?" + queryString1, true);
	ajaxRequest.send(null); 
}


//***********************************for upload story  start**********************************
function ajaxsubmit(){
	var ajaxRequest1;  
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest1 = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest1 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest1 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4 && ajaxRequest1.status == 200){
			var ajaxDisplay1 = document.getElementById('diverrmsg');
			document.upload_story.author_name.value="";
			document.upload_story.email.value="";
			document.upload_story.title.value="";
			document.upload_story.content.value="";
			document.upload_story.uploaded_file_path.value="";
			document.upload_story.from_upload.value="";
			document.getElementById("showimage").innerHTML="";
			document.getElementById("showimage1").style.display="block";
	//		document.getElementById("sub").disabled=true;
			var strelements="author_name,email,title,content";
		arrelements=strelements.split(',');
		var elecount=arrelements.length;
		//alert(elecount);
		for(i=0;i<elecount;i++)
			{
			input=arrelements[i];
			var cal="document.upload_story."+input;
			//document.getElementById('diverrmsg').innerHTML="We need your input in all fields marked in red.";
			document.getElementById('td'+input).src='images/incorrect.gif';
			document.getElementById('tdcol'+input).style.color="#000000";
			
	    }
			ajaxDisplay1.innerHTML = ajaxRequest1.responseText;
		}
	}
	var conte=document.upload_story.content.value;
	var content11=conte.replace(new RegExp( "\\n", "g" ), "<br />" );
	var params = "user_name=" +document.upload_story.author_name.value+ "&user_email="+document.upload_story.email.value+"&title="+document.upload_story.title.value+"&news_text="+content11+"&news_image="+document.upload_story.uploaded_file_path.value;
//	alert(queryString);
	ajaxRequest1.open("POST", "submit_stories.php", true);
	ajaxRequest1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajaxRequest1.setRequestHeader("Content-length", params.length);
	ajaxRequest1.setRequestHeader("Connection", "close");
	ajaxRequest1.send(params); 
}

function validatename(input){
		var cal="document.upload_story."+input;
			if(trimstr(eval(cal).value)==""){
				//document.getElementById('diverrmsg').innerHTML="We need your input in all fields marked in red.";
				document.getElementById('td'+input).src='images/incorrect.gif';
				document.getElementById('tdcol'+input).style.color="#cc0000";
				//eval(cal).focus();
				
			}
			else{
				if(input=="email"){
					invmail=0;
					invemail=echeck(trimstr(eval(cal).value));
					//alert(invemail);
					if(invmail==1){
						document.getElementById('tdemail').src='images/incorrect.gif';
						document.getElementById('tdcolemail').style.color="#cc0000";
					//	eval(cal).focus();
						
					}
					else{
						document.getElementById('tdemail').src="images/correct.gif";
						document.getElementById('tdcolemail').style.color="#000000";
					}
				}
				else{
					document.getElementById('td'+input).src="images/correct.gif";
					document.getElementById('tdcol'+input).style.color="#000000";
				}
			}
	    	if((trimstr(document.upload_story.author_name.value)!="")&&(trimstr(document.upload_story.email.value)!="")&&(trimstr(document.upload_story.content.value)!="")&&(trimstr(document.upload_story.title.value)!="")){
			document.getElementById('diverrmsg').innerHTML="";
		}
		
	}

function validate(){
	//alert ("TESTING");
		var errname=0;
		var errmail=0;
		var errtitle=0;
		var errcontent=0;
		var errcategory=0;
		var cal="document.upload_story"
		if(trimstr(document.upload_story.author_name.value)==""){
			document.getElementById('tdauthor_name').src='images/incorrect.gif';
			document.getElementById('tdcolauthor_name').style.color="#cc0000";
			document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			errname=1;
		}
		else{
			document.getElementById('tdauthor_name').src='images/correct.gif';
			document.getElementById('tdcolauthor_name').style.color="#000000";
			errname=0;
		}
		if(trimstr(document.upload_story.email.value)==""){
			document.getElementById('tdemail').src='images/incorrect.gif';
			document.getElementById('tdcolemail').style.color="#cc0000";
			document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			errmail=1;
		}
		else{
			invmail=0;
			invemail=echeck(trimstr(document.upload_story.email.value));
			if(invmail==1){
				document.getElementById('tdemail').src='images/incorrect.gif';
				document.getElementById('tdcolemail').style.color="#cc0000";
				document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
				errmail=1;
			}
			else{
				document.getElementById('tdemail').src="images/correct.gif";
				document.getElementById('tdcolemail').style.color="#000000";
				errmail=0;
			}
		}
		if(trimstr(document.upload_story.title.value)==""){
			document.getElementById('tdtitle').src='images/incorrect.gif';
			document.getElementById('tdcoltitle').style.color="#cc0000";
			document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			errtitle=1;
		}
		else{
			document.getElementById('tdtitle').src='images/correct.gif';
			document.getElementById('tdcoltitle').style.color="#000000";
			errtitle=0;
		}
		if(trimstr(document.upload_story.content.value)==""){
			document.getElementById('tdcontent').src='images/incorrect.gif';
			document.getElementById('tdcolcontent').style.color="#cc0000";
			document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			errcontent=1;
		}
		else{
			document.getElementById('tdcontent').src='images/correct.gif';
			document.getElementById('tdcolcontent').style.color="#000000";
			errcontent=0;
		}
		rdcheck=false;
		for (counter = 0; counter<upload_story.category.length; counter++){
			if (upload_story.category[counter].checked)
				rdcheck=true;
			}
		if(rdcheck==false){
	//		document.getElementById('tdcontent').src='images/incorrect.gif';
			document.getElementById('tdcolcategory').style.color="#cc0000";
			document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			errcategory=1;
		}
		else{
	//		document.getElementById('tdcontent').src='images/correct.gif';
			document.getElementById('tdcolcategory').style.color="#000000";
			errcategory=0;
		}	
		if((errname==1)||(errtitle==1)||(errmail==1)||(errcontent==1)||(errcategory==1)){
			document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			return false;

		}
	}

	function echeck(str) {
		 var at="@";
		 var dot=".";
		 var lat=str.indexOf(at);
		 var lstr=str.length;
		 var ldot=str.indexOf(dot);
		 if (str.indexOf(at)==-1){
		     invmail=1;
		 }
		 if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		  invmail=1;
		 }
		 if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		  invmail=1;
		 } 
		 if (str.indexOf(at,(lat+1))!=-1){
		  invmail=1;
		 }
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		  invmail=1;
		 }
		 if (str.indexOf(dot,(lat+2))==-1){
		  invmail=1;
		 }
		 if (str.indexOf(" ")!=-1){
		  invmail=1;
		 }
		//invmail=0;
		 return invmail;
	}
	
	function trimstr(str){
	  while (str.charAt(0) == ' ')
		{
			str = str.substring(1);
		}
		while (str.charAt(str.length - 1) == ' ')
		{
			str = str.substring(0, str.length - 1);
		}
		return str;
	}


	
	function showWindow1(url) {
		alert("function called");
	window.open(url, "Upload",
	"height=390,width=640,directories=no,location=no,menubar=no," +
	"scrollbars=yes,status=no,toolbar=no");
} 


//functions for upload story end


//***************************************************************************************

//function for contact form


//function for trim

	function trim(str){
	while (str.charAt(0) == ' '){
		str = str.substring(1);
	 }
	while (str.charAt(str.length - 1) == ' '){
		str = str.substring(0, str.length - 1);
	 }
		return str;

	}


function validate_name(input){
		var cal="document.contact_form."+input;
			if(trim(eval(cal).value)==""){
				//document.getElementById('diverrmsg').innerHTML="We need your input in all fields marked in red.";
				document.getElementById('td'+input).src='images/incorrect.gif';
				document.getElementById('tdcol'+input).style.color="#cc0000";
				//eval(cal).focus();
				
			}
			else{
				if(input=="email"){
					invmail=0;
					invemail=echeck(trim(eval(cal).value));
					//alert(invemail);
					if(invmail==1){
						document.getElementById('tdemail').src='images/incorrect.gif';
						document.getElementById('tdcolemail').style.color="#cc0000";
					//	eval(cal).focus();
						
					}
					else{
						document.getElementById('tdemail').src="images/correct.gif";
						document.getElementById('tdcolemail').style.color="#000000";
					}
				}
				else if(input=="telephone"){
					if(isNaN(trim(eval(cal).value))){
						document.getElementById('tdtelephone').src='images/incorrect.gif';
						document.getElementById('tdcoltelephone').style.color="#cc0000";
					//	eval(cal).focus();
						
					}
					else{
						document.getElementById('tdtelephone').src="images/correct.gif";
						document.getElementById('tdcoltelephone').style.color="#000000";
					}
				}
				else{
					document.getElementById('td'+input).src="images/correct.gif";
					document.getElementById('tdcol'+input).style.color="#000000";
				}
			}
			
		
if((trim(document.contact_form.author_name.value)!="")&&(trim(document.contact_form.telephone.value)!="")&&(trim(document.contact_form.country.value)!="")&&(trim(document.contact_form.email.value)!="")&&(trim(document.contact_form.content.value)!="")&&(trim(document.contact_form.title.value)!="")){
			document.getElementById('diverrmsg').innerHTML="";
		}
		
	}

//*****************************************************************************************************

function validate_contact(){
		var err_name=0;
		var err_mail=0;
		var err_title=0;
		var err_content=0;
		var err_con=0;
		var cal="document.contact_form"
		if(trim(document.contact_form.author_name.value)==""){
			document.getElementById('tdauthor_name').src='images/incorrect.gif';
			document.getElementById('tdcolauthor_name').style.color="#cc0000";
		//	document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_name=1;
		}
		else{
			document.getElementById('tdauthor_name').src='images/correct.gif';
			document.getElementById('tdcolauthor_name').style.color="#000000";
			err_name=0;
		}
		if(trim(document.contact_form.email.value)==""){
			document.getElementById('tdemail').src='images/incorrect.gif';
			document.getElementById('tdcolemail').style.color="#cc0000";
		//	document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_mail=1;
		}
		else{
			invmail=0;
			invemail=echeck(trim(document.contact_form.email.value));
			if(invmail==1){
				document.getElementById('tdemail').src='images/incorrect.gif';
				document.getElementById('tdcolemail').style.color="#cc0000";
		//		document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
				err_mail=1;
			}
			else{
				document.getElementById('tdemail').src="images/correct.gif";
				document.getElementById('tdcolemail').style.color="#000000";
				err_mail=0;
			}
		}
		if(trim(document.contact_form.title.value)==""){
			document.getElementById('tdtitle').src='images/incorrect.gif';
			document.getElementById('tdcoltitle').style.color="#cc0000";
		//	document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_title=1;
		}
		else{
			document.getElementById('tdtitle').src='images/correct.gif';
			document.getElementById('tdcoltitle').style.color="#000000";
			err_title=0;
		}
		if(trim(document.contact_form.content.value)==""){
			document.getElementById('tdcontent').src='images/incorrect.gif';
			document.getElementById('tdcolcontent').style.color="#cc0000";
			//document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_content=1;
		}
		else{
			document.getElementById('tdcontent').src='images/correct.gif';
			document.getElementById('tdcolcontent').style.color="#000000";
			err_content=0;
		}	
		if(trim(document.contact_form.telephone.value)==""){
			document.getElementById('tdtelephone').src='images/incorrect.gif';
			document.getElementById('tdcoltelephone').style.color="#cc0000";
			//document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_tele=1;
		}
		else{
			if(isNaN(trim(document.contact_form.telephone.value))){
				document.getElementById('tdtelephone').src='images/incorrect.gif';
				document.getElementById('tdcoltelephone').style.color="#cc0000";
		//		document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
				err_tele=1;
			}
			else{
				document.getElementById('tdtelephone').src="images/correct.gif";
				document.getElementById('tdcoltelephone').style.color="#000000";
				err_tele=0;
			}
		}
		if(trim(document.contact_form.country.value)==""){
			document.getElementById('tdcountry').src='images/incorrect.gif';
			document.getElementById('tdcolcountry').style.color="#cc0000";
			//document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_con=1;
		}
		else{
			document.getElementById('tdcountry').src='images/correct.gif';
			document.getElementById('tdcolcountry').style.color="#000000";
			err_con=0;
		}
		if(trim(document.contact_form.txtnumber.value)==""){
			//document.getElementById('td_con').src='images/incorrect.gif';
			document.getElementById('tdcolver').style.color="#cc0000";
			//document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_ver=1;
		}
		else{
		//	document.getElementById('td_con').src='images/correct.gif';
			document.getElementById('tdcolver').style.color="#000000";
			err_ver=0;
		}
		if((err_name==1)||(err_title==1)||(err_mail==1)||(err_content==1)||(err_tele==1)||(err_con==1)||(err_ver==1)){
			document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			return false;

		}
	}

	///******************************************************************************************************

// ***************Code For Comment Page*****************************************************************

function validate_comment(input){
		var cal="document.news_comment."+input;
			if(trim(eval(cal).value)==""){
				//document.getElementById('diverrmsg').innerHTML="We need your input in all fields marked in red.";
				document.getElementById('td'+input).src='images/incorrect.gif';
				document.getElementById('tdcol'+input).style.color="#cc0000";
				//eval(cal).focus();
				
			}else{
				if(input=="email"){
					invmail=0;
					invemail=echeck(trim(eval(cal).value));
					//alert(invemail);
					if(invmail==1){
						document.getElementById('tdemail').src='images/incorrect.gif';
						document.getElementById('tdcolemail').style.color="#cc0000";
					//	eval(cal).focus();
						
					}
					else{
						document.getElementById('tdemail').src="images/correct.gif";
						document.getElementById('tdcolemail').style.color="#008000";
					}
				}
					else{
					document.getElementById('td'+input).src="images/correct.gif";
					document.getElementById('tdcol'+input).style.color="#008000";
				}
			}
			
		
if((trim(document.news_comment.author_name.value)!="")&&(trim(document.news_comment.email.value)!="")&&(trim(document.news_comment.content.value)!="")&&(trim(document.news_comment.title.value)!="")){
			document.getElementById('diverr_msg').innerHTML="";
		}
		
	}

//*********************************************************************************************
function validate_news(){
		var err_name_news=0;
		var err_mail_news=0;
		var err_title_news=0;
		var err_content_news=0;
		
		var cal="document.news_comment"
		if(trim(document.news_comment.author_name.value)==""){
			document.getElementById('tdauthor_name').src='images/incorrect.gif';
			document.getElementById('tdcolauthor_name').style.color="#cc0000";
		//	document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_name_news=1;
		}
		else{
			document.getElementById('tdauthor_name').src='images/correct.gif';
			document.getElementById('tdcolauthor_name').style.color="#008000";
			err_name_news=0;
		}
		if(trim(document.news_comment.email.value)==""){
			document.getElementById('tdemail').src='images/incorrect.gif';
			document.getElementById('tdcolemail').style.color="#cc0000";
		//	document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_mail_news=1;
		}
		else{
			invmail=0;
			invemail=echeck(trim(document.news_comment.email.value));
			if(invmail==1){
				document.getElementById('tdemail').src='images/incorrect.gif';
				document.getElementById('tdcolemail').style.color="#cc0000";
		//		document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
				err_mail_news=1;
			}
			else{
				document.getElementById('tdemail').src="images/correct.gif";
				document.getElementById('tdcolemail').style.color="#008000";
				err_mail_news=0;
			}
		}
		if(trim(document.news_comment.title.value)==""){
			document.getElementById('tdtitle').src='images/incorrect.gif';
			document.getElementById('tdcoltitle').style.color="#cc0000";
		//	document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_title_news=1;
		}
		else{
			document.getElementById('tdtitle').src='images/correct.gif';
			document.getElementById('tdcoltitle').style.color="#008000";
			err_title_news=0;
		}
		if(trim(document.news_comment.content.value)==""){
			document.getElementById('tdcontent').src='images/incorrect.gif';
			document.getElementById('tdcolcontent').style.color="#cc0000";
			//document.getElementById('diverrmsg').innerHTML="We need your valid input in all fields marked in red.";
			err_content_news=1;
		}
		else{
			document.getElementById('tdcontent').src='images/correct.gif';
			document.getElementById('tdcolcontent').style.color="#008000";
			err_content_news=0;
		}	
		if((err_name_news==1)||(err_title_news==1)||(err_content_news==1)){
			document.getElementById('diverr_msg').innerHTML="We need your valid input in all fields marked in red.";
			return false;

		}
	}

//*************************************functions for ajaxbox_news start**********************************

function blue1_news(imgid){
	if (imgid==1)
	{
		path1="images/breaking-news.gif";
		path2="images/breaking2.gif";
	}
	if (imgid==2)
	{
		path1="images/top2.gif";
		path2="images/top-stories2.gif";
	}
	if (imgid==3)
	{
		path1="images/popular-2.gif";
		path2="images/most-popular-3.gif";
	}
	if(document.getElementById("img"+imgid).src.indexOf(path1)!="-1"){
	  document.getElementById("img"+imgid).src=path1;
	 }else{
	  document.getElementById("img"+imgid).src=path2;
	 }
}

function black1_news(imgid){
	if (imgid==1)
	{
		path1="images/breaking-news.gif";
		path2="images/breaking.gif";
	}
	if (imgid==2)
	{
		path1="images/top2.gif";
		path2="images/top-stories.gif";
	}
	if (imgid==3)
	{
		path1="images/popular-2.gif";
		path2="images/most-popular-1.gif";
	}
	if(document.getElementById("img"+imgid).src.indexOf(path1)!="-1"){
	document.getElementById("img"+imgid).src=path1;
	}else{
	document.getElementById("img"+imgid).src=path2;
	}
}

function callajax_news(typeid,typeurl){
	
	if (typeurl==2)
	{
		var hgt="100px";
		var hgtload="0px";
		if (typeid==1){
			document.getElementById("img2").src="images/top-stories.gif";
			document.getElementById("img3").src="images/most-popular-1.gif";
			path1="images/breaking-news.gif";
			path2="images/breaking.gif";
		}
		if (typeid==2){
			document.getElementById("img1").src="images/breaking.gif";
			document.getElementById("img3").src="images/most-popular-1.gif";
			path1="images/top2.gif";
			path2="images/top-stories.gif";
		}
		if (typeid==3){
			document.getElementById("img1").src="images/breaking.gif";
			document.getElementById("img2").src="images/top-stories.gif";
			path1="images/popular-2.gif";
			path2="images/most-popular-1.gif";
		}
		 document.getElementById("img"+typeid).src=path1;
	}
	if (typeurl==1)
	{var hgt="75px";
		var hgtload="00px";
		if (typeid==1){
			document.getElementById("img2").src="images/top_blue_main_img.gif";
			document.getElementById("img3").src="images/most-popular-blue-img.gif";
			path1="images/breaking_blue_upper_img.gif";
			path2="images/breaking_dark_blue_main_img.gif";
		}
		if (typeid==2){
			document.getElementById("img1").src="images/breaking_dark_blue_main_img.gif";
			document.getElementById("img3").src="images/most-popular-blue-img.gif";
			path1="images/top_lite_blue_large_img.gif";
			path2="images/top_blue_main_img.gif";
		}
		if (typeid==3){
			document.getElementById("img1").src="images/breaking_dark_blue_main_img.gif";
			document.getElementById("img2").src="images/top_blue_main_img.gif";
			path1="images/most-popular-lite-blue-img2.gif";
			path2="images/most-popular-blue-img.gif";
		}
		 document.getElementById("img"+typeid).src=path1;
	}
	document.getElementById('NewsContent').innerHTML = "<table align=center><tr><td valign=top style='padding-top:"+hgt+"'><img src='images/loading_circle.gif'></td></tr><tr><td valign=middle style='padding-top:0px;'><font style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; text-transform: capitalize; color: #999999;';>LOADING...</font></td></tr></table>";

	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('NewsContent');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	var queryString1 = "typeid=" + typeid +"&typeurl="+typeurl;
	ajaxRequest.open("GET", "news-listing.php?" + queryString1, true);
	ajaxRequest.send(null); 
}


//*************************************functions for ajaxbox_news end**********************************

//*************************************functions for unsubscribe form start**********************************

function doactivate(){
	if(window.document.frmunsubscribe.option[0].checked==true){
		window.document.frmunsubscribe.reason.disabled=true;
	}
	else if(window.document.frmunsubscribe.option[1].checked==true){
		window.document.frmunsubscribe.reason.disabled=false;
	}
}
function validate_unsubscribe(){
		var err=0;
	if((window.document.frmunsubscribe.option[0].checked==false)&&(window.document.frmunsubscribe.option[1].checked==false)){
		err=1;
		document.getElementById("tdcoloption").style.color="#cc0000";
		document.getElementById("diverrmsg").innerHTML="We need your valid input in all fields marked in red.";
		return false;
	}
	else{
		err=0;
		document.getElementById("diverrmsg").innerHTML="";
		document.getElementById("tdcoloption").style.color="#000000";
	}
	if(window.document.frmunsubscribe.option[1].checked==true){
		if((window.document.frmunsubscribe.reason.value.length)==0){
			err=1;
			document.getElementById("diverrmsg").innerHTML="We need your valid input in all fields marked in red.";
			document.getElementById("tdcolreason").style.color="#cc0000";
			return false;
		}else{
			err=0;
			document.getElementById("diverrmsg").innerHTML="";
			document.getElementById("tdcolreason").style.color="#000000";
		}
	}
	if(err==1){
		document.getElementById("diverrmsg").innerHTML="We need your valid input in all fields marked in red.";
		return false;	
	}
	if(err==0){
		document.getElementById("diverrmsg").innerHTML="";
		return true;	
	}
}

//*************************************functions for unsubscribe form end**********************************

//**********************functions for regiter form ************************
function sameid()
{
	var val=document.frmregister.username.value;
	if(document.frmregister.mailid.checked==true){
		document.frmregister.username.value=document.frmregister.email.value;
		document.frmregister.username.disabled=true;
		return;
	}
	else{
		document.frmregister.username.value=val;
		document.frmregister.username.disabled=false;
		return;
	}
}
function ableuser(){
	document.frmregister.username.disabled=false;
	//document.frmregister.submit();
}
function remove_cv(cvpath,memid){
	if(window.confirm("Are you sure, you want to remove CV/Resume?")){
		//window.open('http://208.122.3.214/tm/removecv.php?cvpath='+cvpath+'&mem_id='+memid,'','resizable=no,scrollbars=yes,width=200,height=150');
		window.open('http://208.122.3.214/tm/updateresume_hri.php?cvpath='+cvpath+'&subscriber_id='+memid,'','resizable=no,scrollbars=yes,width=540,height=320');
		return false;
	}
	else{
		return false;
	}
}
function manageresume(subscriber_id){
	window.open('http://208.122.3.214/tm/updateresume_hri.php?subscriber_id='+subscriber_id,'','resizable=no,scrollbars=yes,left=100,top=100,width=540,height=320');
}
function showunsubscribe(){
	if(document.frmregister.status.checked==false){
		document.getElementById("unsubscribe").style.display="block";
		return;
	}
	if(document.frmregister.status.checked==true){
		document.getElementById("unsubscribe").style.display="none";
		return;
	}
}
function doactivate1(){
	if(window.document.frmregister.option[0].checked==true){
		window.document.frmregister.reason.disabled=true;
	}
	else if(window.document.frmregister.option[1].checked==true){
		window.document.frmregister.reason.disabled=false;
	}
}
//**********************functions for regiter form end************************