$(document).ready(function() {
	textEnlarger();
	pngFixes();
	faq_module();
	category_main_gallery();
	testimonial_gallery();
	//service_toolTip();
	service_detail_gallery();
	tabbed_gallery();
	horizontal_nav();
	pagination_pipe();
	decision_tool_page();
	all_search();
	print_tool();
	site_search();
	email_popUp();
	loadingAnim();
	goBackHistory();
	checkEmail();
	last_news_border();
	siteMapShowHide();
	testimonialLabel();
	checkCookie();
	pushpingEventGenerator();
	otherHome();
	footerSEOClear();
	findSearchDotReplacement();
	firstTabSelection();
});

function firstTabSelection(){
 $("div.topMainNavCenter ul li").mouseover(function(){
 	$(this).children("a").addClass("selecteNav");
 	$(this).children("div").show();
 	$(this).children("div").width($(this).width());
 	$(this).children("div").children("a").width($(this).width()-40);
 });
  $("div.topMainNavCenter ul li").mouseout(function(){
  	$(this).children("a").removeClass("selecteNav");
 	$(this).children("div").hide();
 });

 $("div.topMainNavCenter ul li:first").mouseover(function(){
 	$("div.topMainNavLeft").addClass("selectedFirstTab"); 
	$("div.topMainNavCenter ul li:first div").attr("style", "left:-15px; display:block;");
	$(this).children("div").width($(this).width()+15);
 	$(this).children("div").children("a").width($(this).width()-25);
 	 if(jQuery.browser.version == "8.0")
	{
		$("div.topMainNavLeft").attr("style", "background:url(/ATStyle/Images/tabFirst.gif) no-repeat scroll left -1px;"); 
	}

 });
 $("div.topMainNavCenter ul li:first").mouseout(function(){
 	$("div.topMainNavLeft").removeClass("selectedFirstTab"); 
 	$("div.topMainNavCenter ul li:first div").attr("style", "left:-15px; display:none;")
	 if(jQuery.browser.version == "8.0")
	{
		$("div.topMainNavLeft").attr("style", "background:transparent url(/ATStyle/Images/navTopLeft.gif) no-repeat scroll left top;"); 
	}

 });
 
 
 $("div.topMainNavCenter ul li:last").mouseover(function(){
 	$("div.topMainNavRight").addClass("selectedLastTab"); 
	$("div.topMainNavCenter ul li:last div").attr("style", "right:-25px; display:block;");
	$(this).children("div").width($(this).width()+14);
 	$(this).children("div").children("a").width($(this).width()-24);
 	 if(jQuery.browser.version == "8.0")
	{
		$("div.topMainNavRight").attr("style", "background:url(/ATStyle/Images/tabLast.gif) no-repeat scroll left -1px;"); 
	}

 });
 $("div.topMainNavCenter ul li:last").mouseout(function(){
 	$("div.topMainNavRight").removeClass("selectedLastTab"); 
 	$("div.topMainNavCenter ul li:last div").attr("style", "left:-25px; display:none;")
	 if(jQuery.browser.version == "8.0")
	{
		$("div.topMainNavRight").attr("style", "background:transparent url(/ATStyle/Images/navTopRight.gif) no-repeat scroll left top;"); 
	}

 });

}

function otherHome(){
	$(".related_anchor_home_content ul li").mouseover(function(){
	  $(this).children("a").attr("class","hoverRelated");
	});
	$(".related_anchor_home_content ul li").mouseout(function(){ 
	   $(this).children("a").removeAttr("class","hoverRelated");
	});
}


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 ;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return ""
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
var cookies = document.cookie.split(";");
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate.toGMTString()) + ";path=/";
}

function checkCookie()
{
fontZoom=getCookie('fontZoom');
if (fontZoom!=null && fontZoom!="")
  {
	if(fontZoom == 110)
	  {
		$(".outer_container").css("font-size","110%");
		$("a.point12").css("color", "#FF6600");
		$("a.point14").css("color", "#666");
		$(".home_page_ticket li div:first").height(200);
	  }
  }
else 
  {
    setCookie('fontZoom',100,365); 
  }
}

function pushpingEventGenerator(){
	pushpinCount = $("div.search_result_container ul li").length;
    for(pushpini = 0 ;pushpini<pushpinCount;++pushpini)
	{
		$("div.search_result_container ul li:eq(" + pushpini +") a").mouseover(function(){		
			pushpinBubblesCount = $("a.VEAPI_Pushpin").length;
			for(pushpinj = 0 ;pushpinj<pushpinBubblesCount;++pushpinj)
				{	
					if(this.firstChild.textContent == undefined)
					{
						if($("a.VEAPI_Pushpin")[pushpinj].innerText == this.childNodes[0].innerText)
						{
							guidMapper0 = $("a.VEAPI_Pushpin:eq(" +pushpinj +") div").attr("onmouseover");
							$(this).attr("onmouseover",guidMapper0);
							break;
						}
						else
						{
							
							VEHideVEShapeERO(false);
						}
					}
					else if($("a.VEAPI_Pushpin")[pushpinj].innerText.match(this.firstChild.textContent) != null )
					{
						guidMapper0 = $("a.VEAPI_Pushpin:eq(" +pushpinj +") div").attr("onmouseover");
						$(this).attr("onmouseover",guidMapper0);
						break;
					}
					else
					{						
						VEHideVEShapeERO(false);
					}
				}
		});
	}
}

function pngFixes(){
	$('.right_content .content_find_service input:last').attr("src", "/ATStyle/Images/btn_findPng.gif");
	if(screen.width <= 1024){
		$(".topCutBorder").attr("style" , "display:none;");
		$(".botomCutBorder").attr("style" , "display:none;");
	}
	if(jQuery.browser.version != "6.0")
	{
		if($(".right_content .input-search img:first").attr("src") == "/ATStyle/Images/img_search_left.gif"){
			$(".right_content .input-search img:first").attr("src", "/ATStyle/Images/img_search_left.png");
		}
		if($(".right_content .input-search img:last").attr("src") == "/ATStyle/Images/img_search_right.gif"){
			$(".right_content .input-search img:last").attr("src", "/ATStyle/Images/img_search_right.png");
		}
		$(".right_content .input-search input").attr("style" , "background:transparent url(/ATStyle/Images/img_search_bg.png) repeat-x scroll left top")
	}
	if(jQuery.browser.version == "6.0")
	{
		if($(".contact_branch ul li a img").attr("src") == "/ATStyle/Images/img_arrowLink.png"){
			$(".contact_branch ul li a img").attr("src", "/ATStyle/Images/img_arrowLink.gif");
		}
		$(".left_edge").attr("src", "/ATStyle/Images/img_home_leftEdge.gif");
		$(".right_edge").attr("src", "/ATStyle/Images/img_home_rightEdge.gif");
		$(".about_anchor_threeColumn li a.ticket_desc_link img").attr("src", "/ATStyle/Images/img_arrowLink.gif");
	}
	if($(".content h2").text() == "Contact us"){
		$("p").attr("style", "width:700px;");
		$("ul p").attr("style", "width:auto;");
		/*$("p").each(function(i){ 
			if($(this).text() == ""){
				$(this).remove();
			}
		});*/
	}
	if(jQuery.browser.version == "8.0"){
		$(".menu ul li ul li div.inYourHome").css("padding-top", "10px");
	}
	if($.browser.mozilla){
		browser_details=navigator.userAgent;
		if(navigator.appName=="Netscape" ||navigator.appName=="mozila")
		{
			browser_details=browser_details.substring(browser_details.indexOf("Firefox"));
			browser_details=browser_details.substring(0,9);
		}
		if(browser_details == "Firefox/3"){
			$(".search_area .input-search img").css("margin-top","-1px");
			$(".right_content .find_service .input-search img").css("margin-top","-1px");
			$("ul.form_listing li div.input-search img.inputCorner ").css("margin-top","-1px");
			$("ul.page_tool li:last").css("margin","0");
		}
	}
}

//<![CDATA[
	$(document).ready(function() {
		function addMega(){
			$(this).addClass("hovering");
		}
		function removeMega(){
			$(this).removeClass("hovering");
		}
		var megaConfig = {
			interval: 0,
			sensitivity: 4,
			over: addMega,
			timeout: 0,
			out: removeMega
		};
		//$("ul.page_tool li").hoverIntent(megaConfig)
		//$(".menu li").hoverIntent(megaConfig)

	});
//]]>
function siteMapShowHide(){
	$("#expandCollapseAll").click(function(){
		if($(this).attr("class") == "expandAll" || $(this).attr("class") == "expandAll onhover"){
			$("ul.mainPage li ul").removeClass("hide");
			$("ul.mainPage li ul").addClass("show");
			$(this).text("Collapse All");
			$("ul.mainPage li a img").attr("src" , "/ATStyle/Images/minus.gif");
			$("ul.mainPage li a img").attr("alt" , "Hide");
			$(this).attr("class" , "collapseAll");
		}
		else{
			$("ul.mainPage li ul").addClass("hide");
			$("ul.mainPage li ul").removeClass("show");
			$(this).text("Expand All");
			$("ul.mainPage li a img").attr("src" , "/ATStyle/Images/plus.gif");
			$("ul.mainPage li a img").attr("alt" , "Show");
			$(this).attr("class" , "expandAll");
		}
	});
	$("ul.mainPage li ul").addClass("hide");
	$("ul.mainPage li a").each(function(i){ 
		if($(this).next("ul").children("li").length != 0){
			$(this).before("<a id='showHideHolder'><img src='/ATStyle/Images/plus.gif' alt='Show'></a>");
			$(this).prev("a#showHideHolder").attr("style", "cursor:pointer;");
			$(this).parent("li").addClass("siteMapChildrenContent");
		}
		$(this).prev("a#showHideHolder").click(function(){
			var showHideStatus = $(this).parent("li").children("a").next("ul").attr('class');
			if(showHideStatus == "hide"){
				$(this).parent("li").children("a").next("ul").addClass("show");
				$(this).parent("li").children("a").next("ul").removeClass("hide");
				$(this).parent("li").addClass("hideIcon");
				$(this).parent("li").removeClass("showIcon");
				$(this).parent("li").children("a").children("img").attr("src" , "/ATStyle/Images/minus.gif");
				$(this).parent("li").children("a").children("img").attr("alt" , "Hide");
			}
			else{
				$(this).parent("li").children("a").next("ul").addClass("hide");
				$(this).parent("li").children("a").next("ul").removeClass("show");
				$(this).parent("li").addClass("showIcon");
				$(this).parent("li").removeClass("hideIcon");
				$(this).parent("li").children("a").children("img").attr("src" , "/ATStyle/Images/plus.gif");
				$(this).parent("li").children("a").children("img").attr("alt" , "Show");
			}
		});
	});
	
	
}

function textEnlarger(){
	$("a.smallA").css("color", "#b3a8b5");
	$("a.smallA").attr("href", "#");
	$("a.smallA").attr("href", "#");
	$("a.smallA").click(function(){
		$(".outer_container").css("font-size","100%");
		$("a.smallA").css("color", "#b3a8b5");
		$("a.largeA").css("color", "#FFFFFF");
		$(".home_page_ticket li div:first").height(180);
		setCookie('fontZoom',100,365);
		return false;
	});
	$("a.largeA").click(function(){
		$(".outer_container").css("font-size","120%");
		$("a.smallA").css("color", "#FFFFFF");
		$("a.largeA").css("color", "#b3a8b5");
		$(".home_page_ticket li div:first").height(200);
		setCookie('fontZoom',110,365);
		return false;
	});
	
}


function faq_module(){
	$(".faqPop_module").hide();
	$("a.close").hide();
	$("a.close").click(function(){
		$(".faqPop_module").hide();
		$("a.close").hide();
		return false;
	});
	$("div.faq_module_content ul li a").attr({ href: "javascript:;"});
	$('.header_right_area ul li:first a:hover').css("background" , "none");
}

function SetFaq_Popup(parent)
{	
	topCoordinate = parent.parentNode.offsetTop;
	if($.browser.msie){
		if(jQuery.browser.version == "6.0")
		{
			topCoordinate -= 15;
		}
		else
		{
		topCoordinate -= 60;
		}
	}
	if($.browser.mozilla || $.browser.safari){
		topCoordinate -= 10;
	}
	$(".faqPop_module").attr({ style: "position: absolute;top:" + topCoordinate+ "px;left:0px;"});
	$("a.close img").attr({ style: "position: absolute;top:" + topCoordinate+ "px;left:0px;"});
}

function category_main_gallery(){
	$(".gallery_container").hide();
	$("div.galleryMainCategory li:first .gallery_container").show();
	$("div.galleryMainCategory li:first .thumbNail_category").addClass("thumbNail_category current_thumb");
	$("a.thumbNail_category").mouseover(function(){
		$(".gallery_container").hide();		
		$(".thumbNail_category").removeClass("current_thumb");
		$(this).prev(".gallery_container").show();
		$(this).addClass("thumbNail_category current_thumb");
		return false;
	});
}

function testimonial_gallery(){
	$(".testimonial_content").hide();
	$("div.testimonial li:first .testimonial_content").show();
	$("div.testimonial li:first .thumb_testimonial").addClass("thumb_testimonial current_thumbnail_testimonial");
	$("a.thumb_testimonial").click(function(){
		$(".testimonial_content").hide();
		$(".thumb_testimonial").removeClass("current_thumbnail_testimonial");
		$(this).prev(".testimonial_content").show();
		$(this).addClass("thumb_testimonial current_thumbnail_testimonial");
		return false;
	});
}

/*function service_toolTip(){
	$("ul.service_detail li").mouseover(function(){
		$(this).addClass("mouse_overbg");
	});
	$("ul.service_detail li").mouseout(function() {
		$(this).removeClass("mouse_overbg");
	});
}*/

function service_detail_gallery(){
	$(".large_container").hide();
	$("div.service_detail_galleryRight li:first .large_container").show();
	$("div.service_detail_galleryRight li:first .thumbnail_detail").addClass("thumbnail_detail thumbnail_current_detail");
	$("a.thumbnail_detail").mouseover(function(){
		$(".large_container").hide();		
		$(".thumbnail_detail").removeClass("thumbnail_current_detail");
		$(this).next(".large_container").show();
		$(this).addClass("thumbnail_detail thumbnail_current_detail");
	});
}

function tabbed_gallery(){
	$("div.tab_accordin li:first a.tabs").addClass("tabs selected_tabs");
}


function horizontal_nav(){
	$('.left_hor_nav li').each(function() {
		var menu = $(this);
		menu.hover(function() {
			
			menu.addClass('hover');
		}, function() {
			menu.removeClass('hover');
		});
	});
	$('.left_hor_nav li.sectionLinks:last').mouseover(function(){
		$(this).children("ul").attr("class","hover");
	});
	$('.left_hor_nav li.sectionLinks:last').mouseout(function(){
		$(this).children("ul").removeAttr("class","hover");
	});
}

function pagination_pipe(){
	$("div.pagination a:first").addClass("first_pipe");
}

function decision_tool(){
	$("ul.step_decisionTool li:first").addClass("current_step");
	$("ul.step_decisionTool li ul li").show();
	$("ul.step_decisionTool li ul li input").click(function(){
		$(this).parents("ul.step_decisionTool li").nextAll("li.MainIdentifier").hide();
		$("div.button_answer").hide();
		$("div.result_container").hide();
		$(this).parents("ul.step_decisionTool li").next("li.MainIdentifier").show();
		$(this).parents("ul.step_decisionTool li").prev("li").removeClass("current_step");
		$(this).parents("ul.step_decisionTool li").removeClass("current_step");
		$(this).parents("ul.step_decisionTool li").next("li").addClass("current_step");
		$("ul.step_decisionTool li ul li").removeClass("current_step");
		$("div.button_answer").hide();	
	 });
	$("ul.last_record li input").click(function(){
		$("div.button_answer").show();														 
	 });
	
	 $("ul.step_decisionTool li:first ul li input").click(function(){
		 $(this).parents("ul.step_decisionTool li div h2:first").hide();
		 $(this).parents("ul.step_decisionTool li div h2:last").show();
	 });
	 
	 $("ul.step_decisionTool li:first ul li:first input").click(function(){
		 $(this).parents("ul.step_decisionTool li div h2:first").show();
		 $(this).parents("ul.step_decisionTool li div h2:last").hide();
	 });
}


function decision_tool_page(){
	$("ul.step_decisionTool li").hide();
	$("ul.step_decisionTool li:first").show("slow");
	$("ul.step_decisionTool li:first").addClass("current_step");
	$("ul.step_decisionTool li ul li").show();
	$("div.button_answer").hide();
	$("ul.step_decisionTool li ul li input").click(function(){
		$(this).parents("ul.step_decisionTool li").nextAll("li.MainIdentifier").hide();
		$(this).parents("ul.step_decisionTool li").next("li.MainIdentifier").show();
		$(this).parents("ul.step_decisionTool li").prev("li").removeClass("current_step");
		$(this).parents("ul.step_decisionTool li").removeClass("current_step");
		$(this).parents("ul.step_decisionTool li").next("li").addClass("current_step");
		$("ul.step_decisionTool li ul li").removeClass("current_step");
		$("div.button_answer").hide();	
	 });
	$("ul.last_record li input").click(function(){
		$("div.button_answer").show();														 
	 });
	
	 $("ul.step_decisionTool li:first ul li input").click(function(){
		 $(this).parents("ul.step_decisionTool li div h2:first").hide();
		 $(this).parents("ul.step_decisionTool li div h2:last").show();
	 });
	 
	 $("ul.step_decisionTool li:first ul li:first input").click(function(){
		 $(this).parents("ul.step_decisionTool li div h2:first").show();
		 $(this).parents("ul.step_decisionTool li div h2:last").hide();
	 });
	
}



function ReloadDecisionTool()
{
	var classname = $("ul.step_decisionTool li:first ul li span span span").attr("class");
	if(classname == "jNiceRadio jNiceFocus jNiceChecked")
	{
		 $(this).parents("ul.step_decisionTool li div h2:first").show();
		 $(this).parents("ul.step_decisionTool li div h2:last").hide();
	}
	else
	{
		 $(this).parents("ul.step_decisionTool li div h2:first").hide();
		 $(this).parents("ul.step_decisionTool li div h2:last").show();
	}

	 $("ul.step_decisionTool li:first ul li input").click(function(){
		 $(this).parents("ul.step_decisionTool li div h2:first").hide();
		 $(this).parents("ul.step_decisionTool li div h2:last").show();
	 });
	 
	 $("ul.step_decisionTool li:first ul li:first input").click(function(){
		 $(this).parents("ul.step_decisionTool li div h2:first").show();
		 $(this).parents("ul.step_decisionTool li div h2:last").hide();
	 });
}

function all_search(){
	var count = 0;
	var status = $("li.all_service input").attr("checked");
	$("li.all_service input").click(function(){
		if(status==false)
		{
			$("ul.service_detail input").attr("checked","checked");
			$("ul.service_detail .jNiceCheckbox").addClass("jNiceChecked");
			$(this).next("ul.service_detail input").attr("checked","checked");
			$(this).next("ul.service_detail .jNiceCheckbox").addClass("jNiceChecked");
		}
		if(status==true)
		{
			$("ul.service_detail input").removeAttr("checked","checked");
			$("ul.service_detail .jNiceCheckbox").removeClass("jNiceChecked");
			$(this).next("ul.service_detail input").removeAttr("checked");
			$(this).next("ul.service_detail .jNiceCheckbox").removeClass("jNiceChecked");
		}
		if(status == false)
		{
			status = true;
		}
		else
		{
			status = false;
		}
	});
	$("ul.service_detail input").click(function(){
		var spanClass = $("ul.service_detail li span").attr("class");
		
		if($(this).next("label").text() == "All services")
		{
			if(status)
			{
				count = $("ul.service_detail input").length - 1;
			}
			else
			{
				count = 0;
			}
		}
		else
		{
			var checkStatus = $(this).attr("checked");
			if(checkStatus==false)
			{
				count--;	
			}
			if(checkStatus==true)
			{
				count++;
			}
		}
		if (count == $("ul.service_detail input").length - 1)
		{
			$("li.all_service input").attr("checked","checked");
			$("li.all_service .jNiceCheckbox").addClass("jNiceChecked");
		}
		else
		{
			$("li.all_service input").removeAttr("checked","checked");
			$("li.all_service .jNiceCheckbox").removeClass("jNiceChecked");
		}
		
	});
}

function sdi_subHideNow(){
	$('.page_tool li ul').attr('style','display:none');
}

function print_tool(){
	$("ul.page_tool li:first ul li:first a").click(function(){
		$("link#ctl00_printCss").attr("href", "/ATStyle/Css/css_printWithoutImages.css");
		/*$(".top img").attr("style", "display:none");
		$(".service_detail_gallery").attr("style", "display:none");
		$(".sub_section_banner").attr("style", "display:none");
		$(".printLogo").removeAttr("style", "display:block");*/	
		window.print();
		/*location.reload(true)*/
		/*$(".top img").removeAttr("style", "display:none");
		$(".service_detail_gallery").removeAttr("style", "display:none");
		$(".sub_section_banner").attr("style", "display:block");
		$("head link:first").attr("href", "");*/
		$("link#ctl00_printCss").attr("href", "/ATStyle/Css/css_print.css");
	});
	
	$("ul.page_tool li:first ul li:last a").click(function(){
		$("link#ctl00_printCss").attr("href", "/ATStyle/Css/css_print.css");
		window.print();
		/*location.reload(true)*/
	});
	$("ul.page_tool li a").attr("href", "#");
	$("ul.page_tool li a").click(function(){
		return false;
	});
}

function site_search(){
	 $('.srch-Description').each( function(i)
	{   
		val1=$(this).html();
		val2="<span class=\"srch-Title\">";
		val3="";
		val4=$(this).prev();
		val2=val2+val4.html();
		val3=val4.children("a").attr("href");
		val4.attr("style","display:none");
		
		val2=val2+"</span>";
		val1=val2+val1;
		$(this).html(val1);
		$(this).wrap("<a href=\""+val3+"\" class='siteResultContainer'></a>");
	});
	///$(".siteSearchResults .srch-stats:last").attr("style", "top:18px");
	//$(".siteSearchResults .srch-Page:last").addClass("srch-PageCustom");


}

function doClick(buttonName,e)
    {
    	//the purpose of this function is to allow the enter key to 
	    //point to the correct button to click.
		
		    var key;

			 if(window.event)
				  key = window.event.keyCode;     //IE
			 else
				  key = e.which;     //firefox
		
			if (key == 13)
			{
				//Get the button the user wants to have clicked
				var btn = document.getElementById(buttonName);
				if (btn != null)
				{ //If we find the button click it
					btn.click();
					
					event.keyCode = 0
				}
			}
   }
   
function checkEmail(){
	$(".emailForm li:last input").click(function(){
		if($("#ctl00_SendEmailWebpart1_txtfullname").val() == ""){
			$(".emailForm li:first label").addClass("site_search_error");
			return false;
		}
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#ctl00_SendEmailWebpart1_txtboxTo").val())){
			return true;
		}
		$(".emailForm li:odd:first label").addClass("site_search_error");
		return false;
	});
}


function email_popUp(){
	$("a.thickbox").attr("href", "#");
	$("a.thickbox").click(function(){
		$(".email_description").attr("style", "display:block");
	});
	$("a#popupContactClose").attr("href", "#");
}

//centering popup
function loadingAnim(){
	//request data for centering
	var windowWidthLoader = document.documentElement.clientWidth;
	var windowHeightLoader = document.documentElement.clientHeight;
	var loaderHeight = $(".loader img").height();
	var loaderWidth = $(".loader img").width();
	//centering
	$(".loader img").css({
		"position": "absolute",
		"top": (windowWidthLoader/2-loaderHeight/2)/2 - 40,
		"left": (windowWidthLoader/2-loaderWidth/2)/2
	});
	$(".loaderBackground").css({
		"opacity": "0"
	});
	//only need force for IE6
}

function goBackHistory(){
	$("a.result_back").attr("href", "javascript:history.back()");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
 	 window.open(theURL,winName,features);
}

function last_news_border(){
	$(".news .news_section:last").attr("style", "border:none;");
	$(".information_brochure a:odd:first").attr("style", "width:130px;");
}

function SelectedIndexChanged(listName,labelName)
{
	var i = 0;
	var totalSelected = 0;
	var selectedItemsCnt = document.getElementById(labelName);
	var selectedObj = document.getElementById(listName);
	if(selectedObj != null && selectedItemsCnt != null)
	{
		for(i=0; i<selectedObj.options.length; i++)
		{
			if(selectedObj.options[i].selected)
			{
				totalSelected = totalSelected + 1;
			}
		}
		selectedItemsCnt.innerHTML = totalSelected;
		if(totalSelected > faqCount)
		{
			alert('Please select less then or equal to ' + faqCount + ' FAQs.');
			selectedObj.options[selectedObj.selectedIndex].selected = false;
		}
	}
	return true;
}

 /* Function to restrict user from entering more than maxLength pasted characters 
                  Purpose : To truncate data more than the specified maximum characters rather than
                than restricting the entry of data more than the character limit. 
          */
   
function maxLengthPaste(obj,maxChars)
{

 var detect = navigator.userAgent.toLowerCase();
   if(maxChars){
                if ((window.event) && (detect.indexOf("safari") + 1 == 0))
                { //IE
                      var oTR = obj.document.selection.createRange();
                      var iInsertLength = maxChars - obj.value.length + oTR.text.length;
                   try
                    {
                          var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
                          oTR.text = sData;
                    }
                    
                      catch (err)
                      {
                      }
                   if (window.event) 
                   { //IE
                      window.event.returnValue = null;
                   }
                   else 
                   {
                    //not IE
                    obj.value = obj.value.substr(0,maxChars);
                    return false;
                   }
                }
             } 
     
}

   /* Function to restrict user from entering more than maxLength dragged characters.
      
      Purpose : To truncate data more than the specified maximum characters on dragging 
                and dropping text.
                
    */
function maxLengthDrag(obj,maxChars)
{
    var detect = navigator.userAgent.toLowerCase();
     if(maxChars){
        if ((window.event) && (detect.indexOf("safari") + 1 == 0))
         { //IE
              var iInsertLength = maxChars - obj.value.length;
              try {
              var sData = window.event.dataTransfer.getData("Text").substr(0,iInsertLength);
              var r;
              r=window.event.srcElement.createTextRange();
              r.moveToPoint(window.event.x, window.event.y);
              r.text = sData;
              r.select();
             
         }
          catch (err) 
         {
         }
          if (window.event) 
          { //IE
            window.event.returnValue = null;
          } 
          else 
          {
            //not IE
            obj.value = obj.value.substr(0,maxChars);
            return false;
        }
        }
     }
    
}

/* Function to restrict the number of characters entered by the user in a multiline text box. 
    */

function checkTextAreaMaxLength(textBox,e, length)
{
    var mLen = textBox["MaxLength"];
    if(null==mLen)
        mLen=length;
    
    var maxLength = parseInt(mLen);
    if(e.keyCode==13 && (textBox.value.length > maxLength-2))
    {
        if(window.event)//IE
              e.returnValue = false;
        else//Firefox
                e.preventDefault();
    }
    else if(e.keyCode==13 && (textBox.value.length < maxLength))
    {
	}
    else
    {    
        if(!checkSpecialKeys(e))
        {       
             if(textBox.value.length > maxLength-1)
             {
                if(window.event)//IE
                  e.returnValue = false;
                else//Firefox
                    e.preventDefault();
             }         
        } 
    }  
}

//Function to check for special keys.
function checkSpecialKeys(e)
{
    if(e.keyCode == 8 || e.keyCode==46 || e.keyCode==37 || e.keyCode==38 || e.keyCode==39 || e.keyCode==40)
        return true;
    if(e.ctrlKey == true && e.keyCode == 65) //Allowing ctrl+A
        return true;    
    if(e.ctrlKey == true && e.keyCode == 67) //Allowing ctrl+C
         return true;
    if(e.ctrlKey == true && e.keyCode == 88) //Allowing ctrl+X
         return true;
    else
        return false;
}


function testimonialLabel(){
	var testimonialLabelText = $(".show_news").children("label").text();
	if(testimonialLabelText  == "Show testimonials for"){
		$(".show_news").width(468);
	}
	if($.browser.msie){
		$(".inYourHome h2:first").attr("style", "margin-top:-15px;");
	}
	if($(".content h2:first").text() == "Service finder results" || $(".content h2:first").text() == "Service search"){
		$(".content h2:first").attr("style", "margin-top:-20px;");
		$("ul.page_tool").attr("style", "margin:0;");
	}
	if($(".information_brochure_top a").length == "1"){
		$(".information_brochure_top a").attr("style" , "background:transparent url(/ATStyle/Images/img_link_arrow.gif) no-repeat scroll right 15px; padding:14px 11px 0 0;")
		if($.browser.msie){
			$(".information_brochure_top a").attr("style" , "background:transparent url(/ATStyle/Images/img_link_arrow.gif) no-repeat scroll right 15px; padding:14px 11px 14px 0;")
		}
	}
}

function footerSEOClear(){
	if($.browser.msie){
		if(jQuery.browser.version == "6.0")
		{
			if($(".static_content_container:first p:first a").text() == "contactus@anchor.org.uk"){
				$(".tradeMark").attr("style", "position:relative; top:-50px;");
			}
		}
	}
	if($(".testimonial_contentContainer p:first").text() != ""){
		$(this).attr("style", "margin-top:0;");
	}
	else{
		$(".testimonial_contentContainer p:eq(1)").attr("style", "margin-top:0;");

	}
	$(".testimonial_contentContainer p").each(function(i){ 
			if($(this).text() == ""){
				$(this).remove();
			}
		});

}

function findSearchDotReplacement(){
	if(jQuery.browser.version != "6.0")
	{
		$(".service_detail li img").each(function(i){ 
			imgSrc =""+ $(this).attr("src");
			imgSrc = imgSrc.substring(0,imgSrc.indexOf(".gif"));
			$(this).attr("src", imgSrc+".png");
		});
	}
	$(".related_news .related_left_box, .two_column_news .related_left_box:last").attr("style", "border-bottom:none;")
	$(".head_contact:first").attr("style", "font-weight:normal;")
}


//added for revised landing page

function thumbImageOver2Module(bigImageId,bigImageIdHide1,smallImageId,smallImageIdHide1){
		document.getElementById(bigImageId).style.display='block';
		document.getElementById(bigImageIdHide1).style.display='none';
		
		document.getElementById(smallImageId).className='bg_thumbOver';
		document.getElementById(smallImageIdHide1).className='bg_thumbOut';
	}

function thumbImageOver3Module(bigImageId,bigImageIdHide1,bigImageIdHide2,smallImageId,smallImageIdHide1,smallImageIdHide2){
		document.getElementById(bigImageId).style.display='block';
		document.getElementById(bigImageIdHide1).style.display='none';
		document.getElementById(bigImageIdHide2).style.display='none';
		
		document.getElementById(smallImageId).className='bg_thumbOver';
		document.getElementById(smallImageIdHide1).className='bg_thumbOut';
		document.getElementById(smallImageIdHide2).className='bg_thumbOut';
	}

//added for revised landing page


//added for new top nav

<!--
var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.display = 'none';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.display = 'block';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.display = 'none';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 
// -->

//added for new top nav

// function to conditionally enable or disable submit button on the contact us page
function Enable_or_Disable_Submit_button(btnClientId,enabledImage,disabledImage)
{
	if (document.getElementById(btnClientId) != null)
        { 
          var contactUsSubmitImgBtn = document.getElementById(btnClientId);
          
                  
          if(contactUsSubmitImgBtn.disabled==false)
          {
            contactUsSubmitImgBtn.disabled = true;
            contactUsSubmitImgBtn.src=disabledImage;
          }
          else
          {
            contactUsSubmitImgBtn.disabled = false;
            contactUsSubmitImgBtn.src=enabledImage;
          }
          
        } 
}

