$(document).ready(function()
{
	//scroll the message box to the top offset of browser's scrool bar
	$(window).scroll(function()
	{
  		$('#message_box').animate({top:$(window).scrollTop()+"px" },{queue: false, duration:350});  
	});
    //when the close button at right corner of the message box is clicked 
	$('#close_message').click(function()
	{
  		//the messagebox gets scrool down with top property and gets hidden with zero opacity 
		$('#message_box').animate({ top:"+=15px",opacity:0 }, "slow");
	});
});

////Form validate//////////////

    $(document).ready(function() {
      $("#contact").validate({
        rules: {
          x_name: "required",// simple rule, converted to {required:true}
          securityCode: "required",// simple rule, converted to {required:true}
          x_email: {// compound rule
          required: true,
          email: true
        },
         x_comments: {
          required: true,
          minlength:30

        }
        }
      });
    });
////Print Here//////////////
               $(function() {
               
                $("#PrintIT").click( function() {
                    $('#divToPrint').jqprint();
                    return false;
                });
                
            });
        
////Translate///////////////
function translateTo( destLang ){  
  $('body').translate(
      'english', 
      destLang, 
      {not: '#menu,pre, .jq-translate-ui', fromOriginal:true}
      )
}

$(document).ready(function(){

  /*--- snip ---*/

  //when the Google Language API is loaded
  $.translate(function(){ 
    // clear the loading gif
    $('#translate').empty();
    //generate dropdown
    $.translate.ui('select', 'option') 
    // when selecting another language
    .change(function(){
      var lang = $(this).val();
      translateTo(lang);
      $.cookie('destLang', lang, {path:'/', domain:'www.greaterkashmir.com'});
      })
    .val('English') //select English as default
    .appendTo('#translate'); //insert the dropdown to the page

    //insert Google's logo after the dropdown:
  //$.translate.getBranding().appendTo($('#translate'));

    //get previously translated language      
    var destLang = $.cookie('destLang'); 
    if (destLang && destLang != 'English') {
    $('.jq-translate-ui').val(destLang);
    translateTo( destLang );
    }
  });
});

////For Home Page Photos////////////
	$(document).ready(function(){
		$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate",15000, true);
	});

////Main Tabs of home page////////////////
$(document).ready(function() {
 
	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
$(function(){ $("ul#ticker01").liScroll({travelocity: 0.05}); }); 	
 
});
////Font size holder of the story///////////

$('document').ready(function(){
fontSize("#gkfontholder", "#textcontent", 10, 14, 30);
});

///////////Calender///////////////////

            $(function()
            {
				// Set the date format to something that is easy for our backend to understand...
				
				////Date.format = 'yyyy-mm-dd';
				Date.format = 'mm/dd/yyyy';
				
				// Save a reference to the hidden input form field...
				var $hiddenInput = $('#selectedDate');
				
				// initialise the date picker with your chosen settings
				$('#multimonth').datePickerMultiMonth(
					{
				////startDate: '2006-02-01',
				startDate: '02/01/2006',
            			endDate: (new Date()).asString(),
						numMonths:3,
						inline: true
					}
				).dpmmSetSelected( // initialise with the value from the hidden field 
					$hiddenInput.val()
				).bind( // when a new date is selected...
					'dateSelected',
					function(event, date, $td, status)
					{
						// update the hidden field with the selected date...
						$hiddenInput.val(date.asString());
					}
				);
				
				
				// and just for debugging on this page...
				$('#showHiddenValue').bind(
					'click',
					function(e)
					{
						alert($hiddenInput.val());
						return false;
					}
				);
            });
