
/*OnLoad Event*/
$(function(){
	
	/*Loading common Component*/
	$("#header").load("_header.html");
	var fData = "_footer.html";
	var fPage = $("#footer").attr("rel");
		fData +=" "+ fPage;
		
	$("#footer").load(fData);
	
	/*Sub Navigation Check*/
	if($("#subNav").length>0){
		
		/*Loading the sub Navigation*/
		var snURL  = "_subNav.html";
		var snPage = $("#subNav").attr("rel");
			snURL += " " + snPage;
			
			$("#subNav").load(snURL,function(){
			
			/*Binding Click event to sub Navigation links*/
			$("li",this).each(function(){
				$("a", this).not(".external").click(function(){
					$(this).closest("li").addClass("active");
					$(this).closest("li").siblings(".active").removeClass("active");
					var fURL = $(this).attr("href");
					var iURL = fURL;
						fURL +=" #scData > div"; 
					
					/*Load diffrent images of product*/
					if($("#bProducts").length>0){iURL +=" #inBanner > img";$("#inBanner").load(iURL);}
					
					$("#scData").load(fURL, function(){
						
						$(".roundBoxList").each(function(){
							$("li",this).each(function(){
								$(this).hover(function(){
									$(this).find("ul:first").show();
									$(this).addClass("active");
								},function(){
									$(this).find("ul:first").hide();
									$(this).removeClass("active");
								});
							});
						});
						
						if($("#bCompany").length>0){$(".scroll-pane").jScrollPane({
							showArrows: true
						});};
										
					
						
						
						
					});
					//alert($(this).attr("img"));
					return false;
				});
			});
			
			/*Loading first element*/
			$("li:first a",this).trigger("click");

		});
	}
	
	$("#ctOpenings a").each(function(){
		$(this).click(function(){
			var _cURL = $(this).attr("href");
			$(this).closest("#ctOpenings").find("tr.active").removeClass("active");
			$(this).closest("tr").addClass("active");
			$("#carApply").load(_cURL);
			
			return false;
		});
	});
	
	
});
