// JavaScript Document
jQuery(document).ready(function() {
    var tabContainers = jQuery('div.tabs-holdr > div.tabs-content');
    //tabContainers.hide().filter(':first').show();
	tabContainers.css("position","absolute");
	tabContainers.css("marginLeft","247px").hide().filter(':first').css("marginLeft","0").show();

  jQuery('div.tabs ul li a').click(function() {
    
	if(this.hash=='#tab1')
	{
		tabContainers.filter(this.hash).show().animate( { marginLeft:"0" }, { queue:false, duration:500 });	
		tabContainers.filter(':last').animate( { marginLeft:"247px" }, { queue:false, duration:500 });
		tabContainers.filter(this.hash).next().show().animate( { marginLeft:"247px" }, { queue:false, duration:500 });
	}
	else if(this.hash=='#tab2')
	{
		//tabContainers.not(this.hash).animate( { marginLeft:"-247px" }, { queue:false, duration:500 });
		tabContainers.filter(this.hash).show().animate( { marginLeft:"0" }, { queue:false, duration:500 });
		tabContainers.filter(':first').show().animate( { marginLeft:"-247px" }, { queue:false, duration:500 });
		tabContainers.filter(':last').show().animate( { marginLeft:"247px" }, { queue:false, duration:500 });
	}
	else if(this.hash=='#tab3')
	{
		//tabContainers.not(this.hash).animate( { marginLeft:"-247px" }, { queue:false, duration:500 });
		tabContainers.filter(this.hash).show().animate( { marginLeft:"0" }, { queue:false, duration:500 });
		tabContainers.filter(this.hash).prev().show().animate( { marginLeft:"-247px" }, { queue:false, duration:500 });
		tabContainers.filter(this.hash).prev().prev().show().animate( { marginLeft:"-247px" }, { queue:false, duration:500 });
		tabContainers.filter(':last').css('marginLeft','-247px');
	}
    
		//tabContainers.not(this.hash).animate( { marginLeft:"247px" }, { queue:false, duration:500 });
		//alert(tabContainers.not(this.hash).css('marginLeft'))
        jQuery('div.tabs ul li a').removeClass('current');
      	jQuery(this).addClass('current');
        return false;
  });
  
  
	
	var tabContainers1 = jQuery('div.hm-tab-hldr > div.hm-tabs-cont');
   // tabContainers1.hide().filter(':first').show();

   tabContainers1.css("position","absolute");
	tabContainers1.css("marginLeft","260px").hide().filter(':first').css("marginLeft","0").show();

    jQuery('div.hm-tabs ul li a').click(function() {
       /* tabContainers1.hide();
        tabContainers1.filter(this.hash).show();*/
		if(this.hash=='#hmtab1')
	{
		tabContainers1.filter(this.hash).show().animate( { marginLeft:"0" }, { queue:false, duration:500 });	
		tabContainers1.filter(':last').animate( { marginLeft:"260px" }, { queue:false, duration:500 });
		//tabContainers.filter(this.hash).next().show().animate( { marginLeft:"247px" }, { queue:false, duration:500 });
	}
	else if(this.hash=='#hmtab2')
	{
		//tabContainers.not(this.hash).animate( { marginLeft:"-247px" }, { queue:false, duration:500 });
		tabContainers1.filter(this.hash).show().animate( { marginLeft:"0" }, { queue:false, duration:500 });
		tabContainers1.filter(':first').show().animate( { marginLeft:"-260px" }, { queue:false, duration:500 });
		//tabContainers.filter(':last').show().animate( { marginLeft:"247px" }, { queue:false, duration:500 });
	}
        jQuery('div.hm-tabs ul li a').removeClass('current');
      	jQuery(this).addClass('current');
        return false;
    }).filter(':first').click();
	
	
	
	
	  jQuery('.footer-links').hide();
	jQuery(".exp-col").click(function () {
	jQuery('.footer-links').slideToggle('slow', function(){
		jQuery(".exp-col").text(jQuery(".exp-col").text() == '+ Sitemap' ? '- Sitemap' : '+ Sitemap');
        });
		 return false;
   });
	
	jQuery('#acccontent ul li span').filter(function (index) {
                  return index != 0;
                }).hide();
	jQuery('.acc-content ul li a.accH').filter(':first').addClass('selected');
	
	jQuery('.expand').click(function () {
		if(jQuery(this).text()=="Expand All")
		{ 
		jQuery('#acccontent ul li span').slideDown('slow');
		jQuery('.acc-content ul li').find('a.accH').addClass('selected');
		jQuery(this).text("Collapse All");
		}
		else
		{
			jQuery('#acccontent ul li span').filter(function (index) {
                  return index == 0;
                }).slideDown('slow');
		jQuery('#acccontent ul li span').filter(function (index) {
                  return index != 0;
                }).slideUp('slow');
		jQuery('.acc-content ul li').find('a').removeClass('selected');
		jQuery('.acc-content ul li a.accH').filter(':first').addClass('selected');
		jQuery(this).text("Expand All");
		}
		
	});
	
	jQuery('.contract').click(function () {
				jQuery('#acccontent ul li span').filter(function (index) {
                  return index == 0;
                }).slideDown('slow');
		jQuery('#acccontent ul li span').filter(function (index) {
                  return index != 0;
                }).slideUp('slow');
		jQuery('.acc-content ul li').find('a').removeClass('selected');
		jQuery('.acc-content ul li a.accH').filter(':first').addClass('selected');

	});
	
	jQuery('.acc-content ul li a.accH').click(function () 
	{
		tempHeight = jQuery(this).next('span').height();
		jQuery('.acc-content ul li a.accH').removeClass('selected')
		jQuery(this).next('span').slideDown();
		jQuery(this).addClass('selected');
		//alert(tempHeight);
		var indexA = jQuery(".acc-content ul li a.accH").index(this);
		// alert(indexA)
		jQuery('#acccontent ul li span').filter(function (index) {
        return index != indexA;
		}).slideUp();
	});
	
	
});


jQuery(document).ready(function() {
	jQuery("a.exp-col").anchorAnimate();
	jQuery('.submenu').hide()
	
	jQuery('.slid-menu-cont li').click(function() {
       jQuery('.slid-menu-cont li').removeClass('current');
	   jQuery(this).addClass('current');
    });
	jQuery('.arr-rght').click(function() 
	{
		if(jQuery('#t1').attr('class')=='current') 
		{
			jQuery('#t1').removeClass('current');
			jQuery('#t2').addClass('current');
		}
		else
		{
			jQuery('#t2').removeClass('current');
			jQuery('#t1').addClass('current');			
		}
	   	
});
	
	
	
	
	
	
	
	//jQuery('.imgd').height(1);
	//jQuery('.imgd').width(935);
	jQuery('.imgd').hide();
		/*jQuery('#img2').height(1);
	jQuery('#img2').hide();
		jQuery('#img3').height(1);
	jQuery('#img3').hide();
		jQuery('#img4').height(1);
	jQuery('#img4').hide();*/
	jQuery('.tb').click(function() 
	{
		//jQuery(this).prev('.imgd').animate( { height:"1px" }, { queue:false, duration:500 }).hide();
		jQuery('.imgd').slideUp('slow').filter(jQuery(this).next('.imgd'));
		jQuery('.tb').css('z-index','100000').filter(jQuery(this).next('.imgd'));
		jQuery(this).next('.imgd').slideDown('slow');/*animate( { height:"275px" }, { queue:false, duration:500 });*/
	
	});
	
	jQuery('.imgd').click(function() 
	{
		//jQuery(this).prev('.imgd').animate( { height:"1px" }, { queue:false, duration:500 }).hide();
		jQuery(this).slideUp('slow');
		//jQuery('.tb').css('z-index','100000').filter(jQuery(this).next('.imgd'));
		//jQuery(this).next('.imgd').slideDown('slow');/*animate( { height:"275px" }, { queue:false, duration:500 });*/
	
	});
	
	
	jQuery('.arr-left').click(function() 
	{
		if(jQuery('#t1').attr('class')=='current') 
		{
			jQuery('#t1').removeClass('current');
			jQuery('#t2').addClass('current');
		}
		else
		{
			jQuery('#t2').removeClass('current');
			jQuery('#t1').addClass('current');			
		}
	   	
	});
		
		jQuery('.thumbtop').children('p').hide();
		jQuery('.thumbtop').children('p').fadeOut();
	
	
	
	
	
	// Solution Page
	
	var tabContainers = jQuery('div.solutions > div.tabs-content');
    //tabContainers.hide().filter(':first').show();
	tabContainers.css("position","absolute");
	tabContainers.css("marginLeft","247px").hide().filter(':first').css("marginLeft","0").show();

  jQuery('div.tabs ul li a').click(function() {
    
	if(this.hash=='#tab1')
	{
		tabContainers.filter(this.hash).show().animate( { marginLeft:"0" }, { queue:false, duration:500 });	
		tabContainers.filter(':last').animate( { marginLeft:"247px" }, { queue:false, duration:500 });
		//tabContainers.filter(this.hash).next().show().animate( { marginLeft:"247px" }, { queue:false, duration:500 });
	}
	else if(this.hash=='#tab2')
	{
		//tabContainers.not(this.hash).animate( { marginLeft:"-247px" }, { queue:false, duration:500 });
		tabContainers.filter(this.hash).show().animate( { marginLeft:"0" }, { queue:false, duration:500 });
		tabContainers.filter(':first').show().animate( { marginLeft:"-247px" }, { queue:false, duration:500 });
		//tabContainers.filter(':last').show().animate( { marginLeft:"247px" }, { queue:false, duration:500 });
	}
		//tabContainers.not(this.hash).animate( { marginLeft:"247px" }, { queue:false, duration:500 });
		//alert(tabContainers.not(this.hash).css('marginLeft'))
        jQuery('div.tabs ul li a').removeClass('current');
      	jQuery(this).addClass('current');
        return false;
  });
	
});




jQuery.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 1000
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed);
		  	return false;
		})
	})
}


function jsScroller (o, w, h) {
	var self = this;
	var list = o.getElementsByTagName("div");
	for (var i = 0; i < list.length; i++) {
		if (list[i].className.indexOf("help-container") > -1) {
			o = list[i];
		}
	}
	
	//Private methods
	this._setPos = function (x, y) {
		if (x < this.viewableWidth - this.totalWidth) 
			x = this.viewableWidth - this.totalWidth;
		if (x > 0) x = 0;
		if (y < this.viewableHeight - this.totalHeight) 
			y = this.viewableHeight - this.totalHeight;
		if (y > 0) y = 0;
		this._x = x;
		this._y = y;
		with (o.style) {
			left = this._x +"px";
			top  = this._y +"px";
		}
	};
	
	//Public Methods
	this.reset = function () {
		this.content = o;
		this.totalHeight = o.offsetHeight;
		this.totalWidth	 = o.offsetWidth;
		this._x = 0;
		this._y = 0;
		with (o.style) {
			left = "0px";
			top  = "0px";
		}
	};
	this.scrollBy = function (x, y) {
		this._setPos(this._x + x, this._y + y);
	};
	this.scrollTo = function (x, y) {
		this._setPos(-x, -y);
	};
	this.stopScroll = function () {
		if (this.scrollTimer) window.clearInterval(this.scrollTimer);
	};
	this.startScroll = function (x, y) {
		this.stopScroll();
		this.scrollTimer = window.setInterval(
			function(){ self.scrollBy(x, y); }, 40
		);
	};
	this.swapContent = function (c, w, h) {
		o = c;
		var list = o.getElementsByTagName("div");
		for (var i = 0; i < list.length; i++) {
			if (list[i].className.indexOf("help-container") > -1) {
				o = list[i];
			}
		}
		if (w) this.viewableWidth  = w;
		if (h) this.viewableHeight = h;
		this.reset();
	};
	
	//variables
	this.content = o;
	this.viewableWidth  = w;
	this.viewableHeight = h;
	this.totalWidth	 = o.offsetWidth;
	this.totalHeight = o.offsetHeight;
	this.scrollTimer = null;
	this.reset();
};





jQuery(document).ready(function () {
jQuery(".innerrs-content").height(jQuery("#led-cont1").height() + parseInt(jQuery("#led-cont1").css("padding-top"), 10) + parseInt(jQuery("#led-cont1").css("padding-bottom"), 10))
minHeight = jQuery('.innerls-menu').height();
jQuery(".contsm-left-img-blk").css('min-height',minHeight+'px');
var previous = 0;
var backtoPos = 0;
jQuery(".innerrs-content div").css({'display':'block','position':'absolute','margin-left':'750px'});
jQuery(".innerrs-content div").eq(0).css({'margin-left':'0px'});

tabHeight = jQuery(".innerls-menu").height();
contentHeight = jQuery(".innerrs-content div").eq(0).height();
if(tabHeight<contentHeight){
	jQuery(".innerrs-content").animate( { height:(contentHeight+20)+"px" }, { queue:false, duration:200 });
}
else{
	jQuery(".innerrs-content").animate( { height:tabHeight+"px" }, { queue:false, duration:200 });
}

jQuery(".innerls-menu ul li").click(function () {
	
	backtoPos = previous;
    jQuery(".innerrs-content div").eq(previous).stop().animate({marginLeft: "-750px"},500,function(){jQuery(".innerrs-content div").eq(backtoPos).css({'margin-left':'750px'})});
	jQuery(".innerls-menu ul li").eq(previous).removeClass();
	temp = jQuery(".innerls-menu ul li").index(this);
	previous = temp;
	jQuery(this).addClass("current");
	tabHeight = jQuery(".innerls-menu").height();
	contentHeight = jQuery(".innerrs-content div").eq(temp).height();
	if(tabHeight<contentHeight){
		jQuery(".innerrs-content").animate( { height:(contentHeight+20)+"px" }, { queue:false, duration:500 });
	}
	else{
		jQuery(".innerrs-content").animate( { height:tabHeight+"px" }, { queue:false, duration:500 });
	}
	 jQuery(".innerrs-content div").eq(temp).stop().animate({marginLeft: "0px"},500);
	
/*var sectionid = jQuery(this).attr('id');
var tabHeight = jQuery(".innerls-menu").height();
var consection = ("led-" + sectionid);
var str = sectionid.replace("cont", "");
var sectionwidth = (jQuery('#led-' + sectionid).width() + parseInt(jQuery('#led-' + sectionid).css("padding-left"), 10) + parseInt(jQuery('#led-' + sectionid).css("padding-right"), 10));
 var sectionHeight = (jQuery('#led-' + sectionid).height() + parseInt(jQuery('#led-' + sectionid).css("padding-top"), 10) + parseInt(jQuery('#led-' + sectionid).css("padding-bottom"), 10)); 
	if( sectionHeight < tabHeight)
    {
		jQuery(".innerrs-content").animate( { height:(jQuery('.innerls-menu').height()+20)+"px" }, { queue:false, duration:500 });
		
	}
	else
	{
		jQuery(".innerrs-content").animate( { height:sectionHeight+"px" }, { queue:false, duration:500 });
	}

        for (i = 1; i <= jQuery(".innerls-menu li").length; i++) {
			//var src = jQuery(".innerls-menu li").eq(i-1).children('img').attr('src');
            if (i == str) 
			{
				//jQuery(this).children('img').attr('src',src.replace('Off','On'));
                jQuery("#led-" + sectionid).css({marginLeft: -sectionwidth},500);
                jQuery("#led-" + sectionid).css({display: "block"},500);
                jQuery("#led-cont" + i).stop().animate({marginLeft: "0px"},500);
            } 
			else {
				
				//jQuery(".tabs li").eq(i-1).children('img').attr('src',src.replace('On','Off'));
                jQuery("#led-cont" + i).stop().animate({marginLeft: sectionwidth},500);
            }
        }*/
    });
});

jQuery(document).ready(function () {
    jQuery(".innerls-menu ul li").click(function () {
        jQuery(".innerls-menu ul li").attr('class', '');
		jQuery(this).attr('class', 'current');
   });
})

jQuery(document).ready(function () {
    jQuery(".banner-content").css('margin-left','954px');
	
	
jQuery.each(jQuery.browser, function(i) {
   if($.browser.msie){
    jQuery('.slider-content').load('img', function() {
	setTimeout(function(){ jQuery(".banner-content").animate({ marginLeft: "0"}, 500 )}, 2000);
	
	
    return false;
    });
   }else{
      jQuery('.slider-content img').load(function() {
       setTimeout(function(){ jQuery(".banner-content").animate({ marginLeft: "0"}, 500 )}, 2000);
    });
   }
 });
	
	
})



 feedbackvar = false; 
function feedbackform() {
if (false==feedbackvar)
{
$(".feedbackBlock").css("margin-left","0px");
$("#betafeedback").attr('src','../img/common/feedbackIconOn.png');
feedbackvar = true; 
}
else
{
$(".feedbackBlock").css("margin-left","-218px");
//$(".feedbackBlock").animate({marginLeft: "-218px"}, 500);
$("#betafeedback").attr('src','../img/common/feedbackIconOff.png');
feedbackvar = false; 
}
}



jQuery(function() {
	jQuery(".conblkBox ul li").hover(function(){
		//alert("alamraman");
			temp = jQuery(this).find('p').outerHeight()+2;
			jQuery(this).find('p').stop().animate({marginTop:(108-temp)+"px"},500);
		},function () {
			jQuery(this).find('p').stop().animate({marginTop:"105px"},500);
	});
});


jQuery(document).ready(function(){
		
		temp = jQuery("#career-tab-cont1").height()+50;
		jQuery(".career-tab-cont").css("marginLeft","700px");
		var preTabCon = 0;
		var curTabCon = 0;
		jQuery("#career-tab-cont1").animate({marginLeft:0+"px"},500);
		
		jQuery(".career-tab-cont-holder").height(temp);
		jQuery(".career-tabs-content").height(temp);
		jQuery(".career-tabs li").eq(0).addClass("on");
		
		jQuery(".career-tabs li").click(function(){
		
			preTabCon = curTabCon;
			curTabCon = jQuery(".career-tabs li").index(this);
			temp = jQuery("#career-tab-cont"+(curTabCon+1)).height()+50;
			jQuery("#career-tab-cont"+(curTabCon+1)).animate({marginLeft:0+"px"},500);
			
			jQuery(".career-tabs-content").animate({height:temp+"px"},500);
			jQuery(".career-tab-cont-holder").animate({height:temp+"px"},500);
			jQuery(".career-tabs li").eq(curTabCon).addClass("on");
			
			if(preTabCon!=curTabCon){
				jQuery("#career-tab-cont"+(preTabCon+1)).animate({marginLeft:-700+"px"},500,function(){jQuery("#career-tab-cont"+(preTabCon+1)).css("marginLeft","700px")});
				jQuery(".career-tabs li").eq(preTabCon).removeClass();
			}
		});
		
		var pre = -1;
		var cur = 0;
		jQuery("#funLink ul li div").css("display","none");
		jQuery("#funLink ul li").css("font-weight","bold");
		jQuery("#funLink ul li div").css("font-weight","normal");
		jQuery("#funLink ul li").css("cursor","pointer");
		jQuery("#funLink ul li").click(function(){
			cur = jQuery("#funLink ul li").index(this);
			jQuery("#funLink ul li div").eq(cur).slideDown(250);
			if(pre!=-1 && pre!=cur){
				jQuery("#funLink ul li div").eq(pre).slideUp(250);
			}
			pre = cur;
		});
		
		if(jQuery('.mediaClip1').length!=0){
		jQuery(".mediaClip1").colorbox({width:"95%",height:"100%",iframe:"true"});
		}
		if(jQuery('.mediaClip2').length!=0){
		jQuery(".mediaClip2").colorbox({width:"95%",height:"100%",iframe:"true"});
		}
		if(jQuery('.mediaClip3').length!=0){
		jQuery(".mediaClip3").colorbox({width:"95%",height:"100%",iframe:"true"});
		}
		if(jQuery('.mediaClip').length!=0){
		jQuery(".mediaClip4").colorbox({width:"95%",height:"100%",iframe:"true"});
		}
		if(jQuery('.mediaClip5').length!=0){
		jQuery(".mediaClip5").colorbox({width:"95%",height:"100%",iframe:"true"});
		}
		if(jQuery('.carPathPopup1').length!=0){
		jQuery(".carPathPopup1").colorbox({width:"700px", height:"80%", iframe:true});
		}
		if(jQuery('.carPathPopup2').length!=0){
		jQuery(".carPathPopup2").colorbox({width:"700px", height:"80%", iframe:true});
		}
		if(jQuery('.carPathPopup3').length!=0){
		jQuery(".carPathPopup3").colorbox({width:"700px", height:"80%", iframe:true});
		}
		if(jQuery('.carPathPopup4').length!=0){
		jQuery(".carPathPopup4").colorbox({width:"750px", height:"600px", iframe:true});
		}
		if(jQuery('.lobr').length!=0){
		jQuery(".lobr").colorbox({width:"600px", height:"400px", iframe:true});
		}
		if(jQuery('.lobr1').length!=0){
		jQuery(".lobr1").colorbox({width:"650px", height:"600px", iframe:true});
		}
		if(jQuery('.lobr2').length!=0){
		jQuery(".lobr2").colorbox({width:"650px", height:"350px", iframe:true});		
		}
		if(jQuery('.interviewTips').length!=0){
		jQuery(".interviewTips").colorbox();
		}
		if(jQuery('.video').length!=0){
		jQuery(".video").colorbox({ width:"355px", height:"310px"});
		}
		if(jQuery('.video1').length!=0){
		jQuery(".video1").colorbox({ width:"425px", height:"360px"});
		}
		if(jQuery('.video2').length!=0){
		jQuery(".video2").colorbox({ width:"900px", height:"500px"});
		}
		if(jQuery('.audio').length!=0){
		jQuery(".audio").colorbox({ width:"405px", height:"110px"});
		}
		if(jQuery('.adv').length!=0){
		jQuery(".adv").colorbox();
		}
		if(jQuery('.videoflash').length!=0){
		jQuery(".videoflash").colorbox({ width:"355px", height:"310px"});	
		jQuery(".videoflash").attr('src','../solutions/video-servicenext-demo.php');
		}
		if(jQuery('.sndemo').length!=0){
		jQuery(".sndemo").colorbox({ width:"580px", height:"460px"});	
		}
		if(jQuery('.iphone').length!=0){
		jQuery(".iphone").colorbox({ width:"355px", height:"360px"});
		}
		if(jQuery('.iphoneform').length!=0){
		jQuery(".iphoneform").colorbox({ width:"335px", height:"350px", iframe:true});
		}
		if(jQuery('.socialcareers').length!=0){
		jQuery(".socialcareers").colorbox({ width:"680px", height:"475px", iframe:true});
		}
		
		
		
		
		
	});



jQuery(function() {
				jQuery('.sub-location').hide();
	jQuery(".location").hover(function(){
			jQuery(this).find('.sub-location').show();
		},function () {
			jQuery(this).find('.sub-location').hide();
	});
});

