
$(document).ready(function() {

	// top menu attach submenu sign
	$('.primary-menu li').each(function (i) {
		var subm = $(this).find('ul').attr("class");
		if(subm=="hide")
		{
			$(this).find("a:first").attr("class", "smenu");
		}
	});
	
	/* homepage slider parameters */						   
	$('.home-slider').after('<div id="nav">').cycle({ 
	fx:     'fade', 
	speed:  2000, 
	timeout: 5000, 
	pager:  '#nav' 
	});

	/* entire block clickable for latest news */						   
	$(".ln-list li").click(function(){
    	window.location=$(this).find("a").attr("href");
		return false;
	});

	$(".ln-list li").mouseover(function(){
		$(this).addClass('ln-active');
		$(this).find("a").attr("class", "ln-link");
	 
    }).mouseout(function(){
	    $(this).removeClass('ln-active');
		$(this).find("a").attr("class", "");
    });
	
	
	/* entire block clickable for header contact box(present in all interior pages) */	
	$(".header-contact").click(function(){
    	window.location=$(this).find("a").attr("href");
		return false;
	});	
	
	$(".download").click(function()
	{
		var rel = $(".download").attr("rel");
		var href = $(".download").attr("href"); 
		var a = 'set_new_download';
		$.ajaxSetup(
		{
			type: "POST",
			url: "/ajax.php"
		});
		$.ajax(
		{
			data: "action="+a+"&id="+rel,
			success: function(resp){
				if(href=="javascript:void(0);")
				{
					var matches = resp.match(/documents/g);
					if(matches!=null)
					{
						window.location = resp;
						return false;
					}
					else
						alert(resp);
				}
			}
		});
	});	
	
});
	
var v = jQuery("#newsletterform").validate({
	submitHandler: function(form) {
		jQuery(form).ajaxSubmit({
			target: "#result"
		});
	}
});
