$(function(){
	//KC form attachment
	$("div.rightBoxtopBord").each(function(){
		if($(this).text()=="Knowledge Center")
		{$(this).parent().parent().addClass("pdfForm")}
	});
	//Set title attribute to the menu elements
	$('#mainMenu a').live('mouseover',function(){$(this).attr('title',$(this).text());});
	//SEARCH Validate
	$('#searchGoBtn').bind('click',function(){
		if($('#SearchString').val()==''){alert('Please enter the text to be searched');return false}
	});
	//Add CLICK action to Thumb nail Box
	var cntKpress='0';
	$(document).bind('keydown',function(e){if(e.which=='17') cntKpress='1';})
	$(document).bind('keyup',function(e){if(e.which=='17') cntKpress='0';})
	//MailTo action
	//$('span.mail').bind('click',function(){	alert($(this).text())});
	$('a').each(function(){
	if($(this).text()=='Back to top')
	{$(this).attr('href','javascript:scroll(0,0)')}
	if($(this).text()=='[+] Enlarge this image')
		{	var popImgString=$(this).attr('href')
			var mySplitResult = popImgString.split("'")
			if(mySplitResult[1]!=''){
				$(this).attr('href',mySplitResult[1]);
				$(this).attr('rel','light');
				$tempDom = $(this).clone( true )
				$tempDom.text('')
				$(this).parent().parent().prev().wrap($tempDom);
			}
		}
	});
	//Slide function for Right Box
	//$('.slideTog').next().hide();
	$('.slideTog').bind('click',function(){
		$(this).next().slideToggle();
		if($(this).find('.downArrowRightBox').hasClass('downArrowRightBox'))
			{$(this).find('.downArrowRightBox').removeClass('downArrowRightBox').addClass('upArrowRightBox');}
		else
			{$(this).find('.upArrowRightBox').removeClass('upArrowRightBox').addClass('downArrowRightBox');}
	});
	//Add Theme color to menu

	var curnUrl="url="+document.URL+"#fomUpdated";
	curnUrl=curnUrl.replace('/#','/default.asp#')
	$('#smoothmenu-ajax').live('mouseover',menuTheamColor)
	function menuTheamColor(){
	var addColorToMenu=$('.content').attr('class');
	switch(addColorToMenu)
	{	case 'content themePinkPages':		{$('.menuContainer').addClass('themePinkPagesMenu');	break;}
		case 'content themeVioletPades':	{$('.menuContainer').addClass('themeVioletPadesMenu');	break;}
		case 'content themeBluePages':		{$('.menuContainer').addClass('themeBluePagesMenu');	break;}
		case 'content themeSkybluePages':	{$('.menuContainer').addClass('themeSkybluePagesMenu');	break;}
		case 'content themeHotPinkPages':	{$('.menuContainer').addClass('themeHotPinkPagesMenu');	break;}
		case 'content themeYellowPages':	{$('.menuContainer').addClass('themeYellowPagesMenu');	break;}
		case 'content themeOrangePages':	{$('.menuContainer').addClass('themeOrangePagesMenu');	break;}
		case 'content themeSAPyellow':		{$('.menuContainer').addClass('themeSAPyellowMenu');	break;}
		case 'content themeCareers':		{$('.menuContainer').addClass('themeCareersMenu');		break;}
		case 'content themeCareersTest':	{$('.menuContainer').addClass('themeCareersTestMenu');	break;}
		case 'content themeCareersBlue':	{$('.menuContainer').addClass('themeCareersMenuBlue');	break;}
		case 'content themeCareersYellow':	{$('.menuContainer').addClass('themeCareersMenuYellow');	break;}
	}}
	//Show the Feedback form
	$('#outerFullDiv').append('<div id="bgShadow" style="filter: alpha(opacity=50);BACKGROUND-COLOR: #000;z-index:998" ></div>');
	$('#feedShow').bind('click',function(){
		//$('#mainContentArea').slideUp(200);
		var fbPopUpPos=$(window).scrollTop()+($(window).height()-400)/2;	
		$("#feedBackformcontainer").attr('style','top:'+fbPopUpPos+'px;')		
		$("#feedBackformcontainer").fadeIn(500);
		$("#feedBackformcontainer").text('');
		var feedBackCont="<a href='javascript:void(0)' id='closeImageCnt'><img id='closeImage' alt='close Pop-up' title='close' src='images/feedback-close-button.png'/></a><form action='home/feedbackForm.asp?"+curnUrl+"' class='forFB' method='post' name='feedbackForm'><div class='feedBackInnerHeading'>1. What are your reasons for visiting our MphasiS website today?</div><div class='feedCont' id='resonForFeebBack'><input type='checkbox' value='Know about MphasiS and Contact Details' id='reasons1' name='reasons'/>Know about MphasiS and Contact Details<br/><input name='reasons' id='reasons2' value='Service Offering Information' type='checkbox'/>Service Offering Information<br/><input name='reasons' id='reasons3' value='Download Case Studies, Whitepapers, Brochures' type='checkbox'/>Download Case Studies, Whitepapers, Brochures<br/><input name='reasons' id='reasons4' value='Careers' type='checkbox'/>Careers<br/><input name='reasons' id='reasons5' value='Financials' type='checkbox'/>Financials<br/><input name='reasons' id='reasons6' value='Competitive Information' type='checkbox'/>Competitive Information<br/><input type='checkbox' value='Others' id='reasons7' name='reasons'/>Others<input type='text' class='hiddenTxt' id='txtReasonsOthers' name='txtReasonsOthers' value='Please Specify'/></div><div class='feedBackInnerHeading'>2. Please rate this website on the following aspects:</div><div  class='feedCont'><table id='feedbackRate' class='margin5 fontColorCCC'><tr><td class='width15'><strong>Section</strong></td><td class='width10'><strong>Excellent</strong></td><td class='width10'><strong>Very Good</strong></td><td class='width10'><strong>Good</strong></td><td class='width10'><strong>Average</strong></td><td class='width10'><strong>Poor</strong></td><td class='width10'><strong>Didn&#39;t notice</strong></td></tr><tr><td>Homepage</td><td><input name='radioHome' id='radioHome1' value='Excellent' type='radio'/></td><td><input name='radioHome' id='radioHome2' value='Very Good' type='radio'/></td><td><input name='radioHome' id='radioHome3' value='Good' type='radio'/></td><td><input name='radioHome' id='radioHome4' value='Average' type='radio'/></td><td><input name='radioHome' id='radioHome5' value='Poor' type='radio'/></td><td><input name='radioHome' id='radioHome6' value='Din&#39;t notice' type='radio'/></td></tr><tr><td>Navigation</td><td><input name='radioNavigation' id='radioNavigation1' value='Excellent' type='radio'/></td><td><input name='radioNavigation' id='radioNavigation2' value='Very Good' type='radio'/></td><td><input name='radioNavigation' id='radioNavigation3' value='Good' type='radio'/></td><td><input name='radioNavigation' id='radioNavigation4' value='Average' type='radio'/></td><td><input name='radioNavigation' id='radioNavigation5' value='Poor' type='radio'/></td><td><input name='radioNavigation' id='radioNavigation6' value='Din&#39;t notice' type='radio'/></td></tr><tr><td>Content</td><td><input name='radioContent' id='radioContent1' value='Excellent' type='radio'/></td><td><input name='radioContent' id='radioContent2' value='Very Good' type='radio'/></td><td><input name='radioContent' id='radioContent3' value='Good' type='radio'/></td><td><input name='radioContent' id='radioContent4' value='Average' type='radio'/></td><td><input name='radioContent' id='radioContent5' value='Poor' type='radio'/></td><td><input name='radioContent' id='radioContent6' value='Din&#39;t notice' type='radio'/></td></tr><tr><td>Design</td><td><input name='radioDesign' id='radioDesign1' value='Excellent' type='radio'/></td><td><input name='radioDesign' id='radioDesign2' value='Very Good' type='radio'/></td><td><input name='radioDesign' id='radioDesign3' value='Good' type='radio'/></td><td><input name='radioDesign' id='radioDesign4' value='Average' type='radio'/></td><td><input name='radioDesign' id='radioDesign5' value='Poor' type='radio'/></td><td><input name='radioDesign' id='radioDesign6' value='Din&#39;t notice' type='radio'/></td></tr><tr><td>Overall Experience</td><td><input name='radioOverall' id='radioOverall1' value='Excellent' type='radio'/></td><td><input name='radioOverall' id='radioOverall2' value='Very Good' type='radio'/></td><td><input name='radioOverall' id='radioOverall3' value='Good' type='radio'/></td><td><input name='radioOverall' id='radioOverall4' value='Average' type='radio'/></td><td><input name='radioOverall' id='radioOverall5' value='Poor' type='radio'/></td><td><input name='radioOverall' id='radioOverall6' value='Din&#39;t notice' type='radio'/></td></tr></table></div><div class='feedBackInnerHeading'>3. Tell us about yourself ?</div><div class='feedCont threeColRadio'><div><span><input type='radio' value='Analyst' id='rdoUserIs1' name='rdoUserIs'/>Analyst</span></div><div><span><input type='radio' value='CXO' id='rdoUserIs2' name='rdoUserIs'/>CXO</span></div><div><span><input type='radio' value='Homemaker' id='rdoUserIs3' name='rdoUserIs'/>Homemaker</span></div><div><span><input type='radio' value='Management' id='rdoUserIs4' name='rdoUserIs'/>Management</span></div><div><span><input type='radio' value='MphasiS Employee' id='rdoUserIs5' name='rdoUserIs'/>MphasiS Employee</span></div><div><span><input type='radio' value='Not Employed' id='rdoUserIs6' name='rdoUserIs6'/>Not Employed</span></div><div><span><input type='radio' value='Researcher' id='rdoUserIs7' name='rdoUserIs'/>Researcher</span></div><div><span><input type='radio' value='Retired' id='rdoUserIs8' name='rdoUserIs'/>Retired</span></div><div><span><input type='radio' value='Sales &amp; Marketing9' id='rdoUserIs9' name='rdoUserIs'/>Sales &amp; Marketing</span></div><div><span><input type='radio' value='Student' id='rdoUserIs10' name='rdoUserIs'/>Student</span></div><div><span><input type='radio' value='Technical' id='rdoUserIs11' name='rdoUserIs'/>Technical</span></div><div><span><input type='radio' value='Others' id='rdoUserIs' name='rdoUserIs'/>Others&nbsp;<input type='text' value='Please Specify' class='hiddenTxt' id='txtTellUsOthers' name='txtTellUsOthers'/></span></div></div><div class='cB feedBackInnerHeading'>4. Industry</div><div class='feedCont threeColRadio'><div><span><input type='radio' value='Airlines' id='radioIndustry1' name='radioIndustry'/>Airlines</span></div><div><span><input type='radio' value='Banking' id='radioIndustry2' name='radioIndustry'/>Banking</span></div><div><span><input type='radio' value='Capital Markets' id='radioIndustry3' name='radioIndustry'/>Capital Markets</span></div><div><span><input type='radio' value='Cards' id='radioIndustry4' name='radioIndustry'/>Cards</span></div><div><span><input type='radio' value='Energy &amp; Utilities' id='radioIndustry5' name='radioIndustry'/>Energy &amp; Utilities</span></div><div><span><input type='radio' value='Freight, Rail &amp; Logistics' id='radioIndustry6' name='radioIndustry'/>Freight, Rail &amp; Logistics</span></div><div><span><input type='radio' value='Government' id='radioIndustry7' name='radioIndustry'/>Government</span></div><div><span><input type='radio' value='Healthcare' id='radioIndustry8' name='radioIndustry'/>Healthcare</span></div><div><span><input type='radio' value='Insurance' id='radioIndustry9' name='radioIndustry'/>Insurance</span></div><div><span><input type='radio' value='Manufacturing' id='radioIndustry10' name='radioIndustry'/>Manufacturing</span></div><div><span><input type='radio' value='Life Sciences' id='radioIndustry11' name='radioIndustry'/>Life Sciences</span></div><div><span><input type='radio' value='Media &amp; Entertainment' id='radioIndustry12' name='radioIndustry'/>Media &amp; Entertainment</span></div><div><span><input type='radio' value='Mobility' id='radioIndustry13' name='radioIndustry'/>Mobility</span></div><div><span><input type='radio' value='Payments' id='radioIndustry14' name='radioIndustry'/>Payments</span></div><div><span><input type='radio' value='Retail &amp; Consumer Packaged Goods' id='radioIndustry15' name='radioIndustry'/>Retail &amp; Consumer Packaged Goods</span></div><div><span><input type='radio' value='Telecom' id='radioIndustry16' name='radioIndustry'/>Telecom</span></div><div><span><input type='radio' value=' Transportation &amp; Logistics' id='radioIndustry17' name='radioIndustry'/>Transportation &amp; Logistics</span></div><div><span><input type='radio' value='Travel &amp; Hospitality' id='radioIndustry18' name='radioIndustry'/>Travel &amp; Hospitality</span></div><div><span><input type='radio' id='radioIndustry' name='radioIndustry' value='Others'/>Others<input type='text' class='hiddenTxt' id='txtIndustry' value='Please Specify' name='txtIndustryOthers'/></span></div></div><div class='cB feedBackInnerHeading'>5. Personal Details</div><div class='feedCont'><div class='personalDetails'><div class='detailCont'><div class='details'>First Name:</div><input type='text' id='txtFirstName' name='txtName'/></div><div class='detailCont'><div class='details'>Last Name:</div><input type='text' id='txtLastName' name='txtName'/></div><div class='detailCont'><div class='details'>E-mail:</div><input type='text' id='txtEmail' name='txtEmail'/></div></div><div class='personalDetails'><div class='detailCont'><div class='details'>Comments and Queries :</div><textarea name='txtrComments' id='txtrComments' cols='30' rows='5'></textarea></div></div></div><div class='Feedsubmit' align='center'><input type='submit' onclick='get_check_value()' class='btn' value='Submit' id='btnSubmit' name='btnSubmit'/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='reset' class='btn' value='Reset' id='resetFeedBack' name='resetFeedBack' /></div></form>";
		$("#feedBackformcontainer").html(feedBackCont);		
		$('#bgShadow').fadeIn();		
		$('#bgShadow').width($(document).width());
		$('#bgShadow').height(($(document).height()));
		$("#reasons1").focus()
	});
	if((document.URL).search("#fomUpdated")!=-1)
	{
		var fbPopUpPos=$(window).scrollTop()+($(window).height()-400)/2;	
		$("#feedBackformcontainer").attr('style','top:'+fbPopUpPos+'px;')		
		$("#feedBackformcontainer").fadeIn(500);
		$("#feedBackformcontainer").text('');
		var feedBackCont='<div id="feedbackTxt" style="height:300px">Thanks for your valuable feedback..<a href="javascript:void(0)" id="closeImageCnt"><img src="images/feedback-close-button.png" alt="closeBtn" id="closeImage"/></a></div>';
		$("#feedBackformcontainer").html(feedBackCont);
		$('#bgShadow').fadeIn();
		$('#bgShadow').width($(document).width());
		$('#bgShadow').height(($(document).height())+20);
		setTimeout(function(){$("#feedBackformcontainer").fadeOut(500);$('#bgShadow').fadeOut()},3000);
	}
	//Hide Feedback form
	$('#closeImageCnt').live('click',
	function fBfadeout() {
		$('#feedBackformcontainer').find('form').slideUp();
		//$('#feedBackformcontainer').html('<div id="feedbackTxt" style="height:300px">Thanks for your valuable feedback..<img src="images/closeIcon.jpg" alt="closeBtn" id="closeImage"/></div>');
		$("#feedBackformcontainer").fadeOut(500);$('#bgShadow').fadeOut();
	});
	$('.forFB').live('submit',fBfadeout);
	function fBfadeout() {
		setTimeout(function(){
		scroll(0,0);
		$('#feedBackformcontainer').find('form').slideUp();
		$('#feedBackformcontainer').html('<div id="feedbackTxt" style="height:300px">Thanks for your valuable feedback..<a href="javascript:void(0)" id="closeImageCnt"><img src="images/closeIcon.jpg" alt="closeBtn" id="closeImage"/></a></div>');
			setTimeout(function(){$("#feedBackformcontainer").fadeOut(500);$('#bgShadow').fadeOut()},3000);
		},3000);
	}
	//Feedback highLight functionality
	$('#feedbackRate input').live("mouseover", function() {
		$(this).parent('td').parent('tr').find('td:eq(0)').css('background','#f5f5f5');
	});
	$('#feedbackRate input').live("mouseout", function() {
		$(this).parent('td').parent('tr').find('td:eq(0)').css('background','')
	});
	$('.threeColRadio input').live("mouseover", function() {
		$(this).parent('span').parent('div').css('background','#f5f5f5');
	});
	$('.threeColRadio input').live("mouseout", function() {
		$(this).parent('span').parent('div').css('background','');
	}); 

	function imgPopup(){
		var popImgString=$(this).attr('href')
		var mySplitResult = popImgString.split("'")
		//mySplitResult[1];
		$(this).attr('href',mySplitResult[1]);
		$(this).attr('rel','light');
		alert($(this).attr('href'));
		$('#outerFullDiv').append('<div id="popupbg" style="display:none"></div><div id="popUpImgCnt" style="display:none"><div id="popupclose"><a href="javascript:void(0)"> <img src="images/close-button-yellow.jpg" /></a></div><img src="'+mySplitResult[1]+'" /></div> <div class="popupclick" style="padding-left:300px"><a href="javascript:void(0)">Click</a></div>')
		 $('#popupclose').click(function(){
        $('#popupbg').hide();
        $('#popUpImgCnt').hide();	

      })
		//$('#outerFullDiv').append("<div class='popUpImgCnt'><img src='"+mySplitResult[1]+"'><br /><img src='images/close-button-yellow.jpg'></div>")
	}
		//$('#outerFullDiv').append("<div><img src='"+mySplitResult[1]+"'/>fghfg</div>")

	$('.thumbLink').each(function(){
		/*var nav=$(this).find('a').attr('href');
		if(cntKpress=='0')	{window.open(nav,"_parent")}else {window.open(nav,"_newtab");}*/
		var nav=$(this).find('a').attr('href');
		var trg=$(this).find('a').attr('target');		
		$(this).wrap('<a style="text-decoration:none;" href="'+nav+'" target="'+trg+'"></a>');
		$(this).find('h2').css('color','#000').css('text-decoration','none');
		$(this).find('p').css('color','#585757').css('text-decoration','none');
		var accHead=$(this).find('h2').html();
		$(this).find('a').append('<span class="scrReaderTxt">&nbsp;on '+accHead+'</span>')
		if($(this).find('a').hasClass("extSite")){
			$(this).find('a').append('<span class="scrReaderTxt">(External website that opens in a new window)</span>');
		}
		if($(this).find('a').hasClass("otrSite")){
			$(this).find('a').append('<span class="scrReaderTxt">(Other section page that opens in a new window)</span>');
		}
		$(this).find('h2').wrap('<a style="text-decoration:none;" href="'+nav+'" target="'+trg+'"></a>');
	});	
	$(".topLeftCorner").parent().addClass("ie6_h5");
	//for fixing IE 6 position fixed
	if($("#feedShow").css("position")=="absolute"){$(window).scroll(feedBackPositionFixed)}
	function feedBackPositionFixed(){ 
		var wHeight=$(window).height()+$(window).scrollTop()-55;
		$("#feedShow").css("top",wHeight+"px")
    }
	//to highlight parent in the main menu
	$("#smoothmenu-ajax a").live("mouseover",highLightParent_removePreviousValues);
	function highLightParent_removePreviousValues(){
		$("#smoothmenu-ajax a").removeClass("highLightParent")
		var parentElm=$(this).parent().parent().prev();
		highLightParent(parentElm);
	}
	function highLightParent(parentElm){
		if($(parentElm).get(0).tagName=="A")
		{
			$(parentElm).addClass("highLightParent")
			parentElm=$(parentElm).parent().parent().prev();
			highLightParent(parentElm);	
		}
	}	
	// disable right click on the KC-PDF links
	$(".pdfForm").bind("contextmenu",function(e){return false});
	//Career accordion functionality
	$(function(){
		$(".contentAcordianMenu>div>h2").addClass("leftArrowRightAccord").css("cursor","pointer");
		$(".contentAcordianMenu>div>p").addClass("leftArrowRightAccord").css("cursor","pointer");
		$(".contentAcordianMenu>div").css("margin","5px")
		$(".contentAcordianMenu>div>div").hide();
		$(".contentAcordianMenu>div>h2").click(function(){
			$(this).next().slideToggle(200);
			$(this).toggleClass("rightArrowRightAccord");										
		});									
		$(".contentAcordianMenu>div>p").hover(function(){										
			if($(this).next().is(':hidden')){
				$(this).parent().parent().find("div div").slideUp(200);
				$(".contentAcordianMenu p").removeClass("rightArrowRightAccord");											
				$(this).next().slideToggle(200);
				$(this).toggleClass("rightArrowRightAccord");
			}
		});									
		$(".contentAcordianMenu>div>p").eq(0).next().slideDown(200);
		$(".contentAcordianMenu>div>p").addClass("rightArrowRightAccord");
		/*function pageCntAccord(){
			var pageURL = document.location.href;
			var pageUrlAr=pageURL.split(".asp")
			$(pageUrlAr[1]).next().show(200);
			$(pageUrlAr[1]).addClass("rightArrowRightAccord");
		setTimeout(pageCntAccord,500);
		}									
		pageCntAccord();*/
		$("#expCollaose").bind("click",function(){
			if($(this).text()=="Expand all"){
				$(this).text("Collapse all");
				$(".contentAcordianMenu h2").addClass("rightArrowRightAccord");
				$(".contentAcordianMenu>div>div").slideDown(200);
				$(this).toggleClass("rightArrowRightAccord");	
			}else{
				$(this).text("Expand all");
				$(".contentAcordianMenu h2").removeClass("rightArrowRightAccord");
				$(".contentAcordianMenu>div>div").slideUp(200);
				$(this).toggleClass("rightArrowRightAccord");	
			}
		});
	});
	
});
function callFBload(){document.getElementById('forFBfadeout').click();
}
function showStockChart(){window.open('http://www.contentlinks.asiancerc.com/mphasisbfl/shareprice.asp','win1',"width=650,height=579,left=105,top=75,location=no,toolbar=no,status=no,resizable=no,scrollbars=yes,directories=no");}
