
<!--  Uthai javascript file end  -- >

/* Mainmenu Key Press */
function get_mainmenu_keypress()
{
  document.getElementById('main_menu_name').style.color='gray';
}

/* Submenu Key Press */
function get_submenu_keypress(mm_id)
{ 
  document.getElementById('sub_menu_name_'+mm_id).style.color='gray';
}

/* Search Key Press */
function get_search_keypress()
{ 
	//alert('somehere');
  document.getElementById('search_keyword').style.color='gray';
}

/* Search Keywords */
function search_function()
{ 
  var search_val = $("#search_keyword").val();

  if(search_val =="" || search_val =="Search StIrling.dk")
  {
    document.getElementById('search_keyword').value='Search StIrling.dk';
    document.getElementById('search_keyword').style.color='red';
    return false;	
  }
  else
  {
     window.location="search-results.php?search_keyword="+search_val;
	//$("#search_keyword").val("Search StIrling.dk");
  }
}


/*news_box_archive*/
function view_news_box_archive(newsboxid){
	var dataString ='&id='+newsboxid+'&action=viewmode';
	
	$.ajax({
		  type: "POST",
		  url: "news_box_archive_ajax.php",
		  data: dataString,
		  success: function(data) {
				$(".contact-left-content").html(data);
				
			}
		});
}

/*front page news_archive*/
function front_view_news_archive(){
	var showpage = $("#drop_page1").val();
	var showyear = $("#drop_year1").val();
	var dataString ='cont='+showpage+'&action=frontview'+'&sryear='+showyear;
	$.ajax({
		  type: "POST",
		  url: "news_box_archive_ajax.php",
		  data: dataString,
		  success: function(data) {
		  	
			   var dt = data.split('||');
				//$("#fristrecord").hide();
				if(dt[0]>0){
					$("#selectrecord").show(dt[0]);
				}else{
					$("#selectrecord").hide();
				}
				$("#selectrecord").html(dt[1]);
				//$("#display_all_search_news_box").html(dt[2]);
				$("#index-description-right-content3").html(dt[2]);
			}
	});
}



/* Search Key Press */
function get_newsletter_keypress(id)
{ 
  document.getElementById('email_id'+id).style.color='gray';
}

/*function newsletter*/
function newsletter(emid){
	var emailid = $('#email_id'+emid).val();
	if(emailid=='' || emailid=='Submit your email here for newsletters')
	{
		document.getElementById('email_id'+emid).style.color='red';
		document.getElementById('email_id'+emid).value='Submit your email here for newsletters';
	}else{
		var str=emailid;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   document.getElementById('email_id'+emid).style.color='red';
			document.getElementById('email_id'+emid).value='Submit your email here for newsletters';
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   document.getElementById('email_id'+emid).style.color='red';
			document.getElementById('email_id'+emid).value='Submit your email here for newsletters';
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    ///alert("Invalid E-mail ID")
			document.getElementById('email_id'+emid).style.color='red';
			document.getElementById('email_id'+emid).value='Submit your email here for newsletters';
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    //alert("Invalid E-mail ID")
			document.getElementById('email_id'+emid).style.color='red';
			document.getElementById('email_id'+emid).value='Submit your email here for newsletters';
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
			document.getElementById('email_id'+emid).style.color='red';
			document.getElementById('email_id'+emid).value='Submit your email here for newsletters';
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
			document.getElementById('email_id'+emid).style.color='red';
			document.getElementById('email_id'+emid).value='Submit your email here for newsletters';
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    //alert("Invalid E-mail ID")
			document.getElementById('email_id'+emid).style.color='red';
			document.getElementById('email_id'+emid).value='Submit your email here for newsletters';
		    return false
		 }
		
		
		/*ajax for mail send*/
		var dataString ='&emailid='+emailid+'&action=email';
		//alert(dataString);
		$.ajax({
			  type: "POST",
			  url: "newsletter.php",
			  data: dataString,
			  success: function(data) {
					$('#email_id'+emid).val(data);
				}
		});
	}
}



