﻿// JScript File
//function ModalPopup(url)
//{
//  jQuery('#model').modal();
//  var iframe_id = "#model_iframe";
//  jQuery(iframe_id).attr("src", url);  
//  return false;
//}

function SetCarousal(showid,hideid)
{
    jQuery('#'+showid).show();   
    jQuery('#'+hideid).hide();
}

jQuery(document).ready(function()
{  
    jQuery(document).pngFix(); 
    
    jQuery("input:text[id*='txtWord']").blur(BindBlurEventFortextBox);
    jQuery("input:text[id*='txtWord']").focus(BindFocusEventFortextBox);
    
    
    //if(jQuery('ul#hotJobsCarousal').length > 0)
    //{
//        jQuery('.slider').jCarouselLite
//        (
//            {
//                btnNext: "",
//        		btnPrev: "",
//       		    scroll: 1,
//                visible: 1,
//                auto:3000,
//                wrap:'last'
//            }
//        );
	//}
    
    if(jQuery('ul#hotCandidateCarousal').length > 0)
    {
	    jQuery('ul#hotCandidateCarousal').innerfade(
        {
		    speed: 750,
            animationtype: 'fade',
            timeout: 3000,
            type: 'sequence',
            containerheight: '6em',
            runningclass:'innerfade',
            slide_timer_on: 'yes',
            slide_ui_text: 'hotCandidateCarousal',
            slide_ui_parent: 'hotCandidateCarousal',
            slide_nav_id: 'hotCandidateCarousal_nav'
	    });
	}
	
    if(jQuery('ul#JobSeekers').length > 0)
    {
	    jQuery('ul#JobSeekers').innerfade(
        {
		    speed: 750,
            animationtype: 'fade',
            timeout: 3000,
            type: 'sequence',
            containerheight: '6em',
            runningclass:'innerfade',
            slide_timer_on: 'yes',
            slide_ui_text: 'JobSeekers',
            slide_ui_parent: 'JobSeekers',
            slide_nav_id: 'JobSeekers_nav'
	    });
	    
	    jQuery.setOptionsButtonEvent();
	    
	    
	    jQuery("#MTRJTestimonialNext").click(function() 
        {
            jQuery.next();
        });
        
        jQuery("#MTRJTestimonialPrevious").click(function() 
        {
            jQuery.prev();
        });
	}
    //jQuery("table.TabControlTable").attr("cellpadding","0");

    
    if(jQuery('ul#employer').length > 0)
    {
	    jQuery('ul#employer').innerfade(
        {
		    speed: 750,
            animationtype: 'fade',
            timeout: 2000,
            type: 'sequence',
            containerheight: '6em',
            runningclass:'innerfade',
            slide_timer_on: 'yes',
            slide_ui_text: 'employer',
            slide_ui_parent: 'employer',
            slide_nav_id: 'employer_nav'
    		
    		
	    });
    	
    	jQuery.setOptionsButtonEvent();
    	
	    jQuery("#MTRTestimonialNext").click(function() 
        {
            jQuery.next();
        });
        
        jQuery("#MTRTestimonialPrevious").click(function() 
        {
            jQuery.prev();
        });
    }
    
	
    
    
    if(jQuery('ul#HomeSlider').length>0)
    {
        jQuery('ul#HomeSlider').innerfade({
            speed: 1500,
            animationtype: 'fade',
            timeout: 10000,
            type: 'sequence',
            containerheight: '6em',
            runningclass:'homeinnerfade',
            slide_timer_on: 'yes',
            slide_ui_text: 'HomeSlider',
            slide_ui_parent: 'HomeSlider',
            slide_nav_id: 'HomeSlider_nav'
        });
        
        jQuery.setOptionsButtonEvent();
        
        jQuery("#MTRHeroNext").click(function() 
        {
            jQuery.next();
        });
        
        jQuery("#MTRHeroPrevious").click(function() 
        {
            jQuery.prev();
        });
    }
    
	ChangePageHeight();
}); 





function BindBlurEventFortextBox()
{
    //jQuery(this).attr("value","Search M&T Resources");
}

function BindFocusEventFortextBox()
{
    jQuery(this).attr("value","");
}


function ChangeBodyBackground(className)
{
    if(className.length > 0)
    {
        var elements = document.getElementById('maindiv');
        elements.className=className;
    }
}

function ChangePageHeight()
{  
    //var elements = document.getElementsByTagName('body');
    var zonecontent = document.getElementById('zonecontent');
    var winHeight = jQuery(window).height();
    
    winHeight = winHeight - 137;
    
    var zonecontentHeight = jQuery("#zonecontent").height();
    
    if(zonecontentHeight > winHeight)
    {
        winHeight = zonecontentHeight;
    }
    //jQuery("#zonecontent").height(winHeight);
    //zonecontent.style.height=winHeight+"px";
}


// These are for the paste Event
function BeforePaste_Event(e)
{
    if(window.event==null)
    {
        e.preventDefault();
    }
    else
    {
        e.returnValue = false;
    }
    //event.returnValue = false;
}

function Paste_Event(e)
{
    if(window.event==null)
    {
        e.preventDefault();
    }
    else
    {
        e.returnValue = false;
    }
    // This is for Getting the Source Element..
    //var objTxtBox = window.event.srcElement; 
    // Cancel default behavior, ie., The Pasting Functionality..
    // Still if you need to paste but need to check some condition, you can use the below codes
    // Get the pasted value from the clipboard..
    //var PasteData = window.clipboardData.getData("Text");
//    if ( // Give your condition here PasteData == some condition )
//    {
//        // This is the case where the pasted text is float and it is less than 24,
//        objTxtBox.value = PasteData;
//    }    
}

function MouseOverOut(varID,imgName)
{
	varID.src=imgName;	
}


var first = 0;
var speed = 1000;
var pause = 2500;

function fastFactsTicker() 
{
    interval = setInterval(removeFirst, pause);
}

function removeFirst() 
{
    first = $('ul#hotJobsCarousal li:first').html();
    $('ul#hotJobsCarousal li:first')
			.animate({ opacity: 0 }, speed)
			.fadeOut('fast', function() { $(this).remove(); });
    addLast(first);
}

function addLast(first) 
{
    last = '<li style="display:none">' + first + '</li>';
    $('ul#hotJobsCarousal').append(last)
    $('ul#hotJobsCarousal li:last')
			.animate({ opacity: 1 }, speed)
			.fadeIn('slow');
}
jQuery(document).ready(function()
{ 
    fastFactsTicker();
});


function AnyInput_KeyDown (e, target)
{
    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13))
    {
        __doPostBack('plcRoot$Layout$zoneTop$MTRSearchbox$btnImageButton','')
        return false;
    }
    return true;
}