//var slowSpeed = 500;
//var fastSpeed = 200;
//var GalBoolSetting=false;
//var globalCounter = 0;
//var globalTotalImgLen = 0;
//
//jQuery(document).ready(function() {
//	var defImageLoadTemplArray = new Array("mtpl1","mtpl2","mtpl3","mtpl4","mtpl5","mtpl6","mtpl7","mtpl8","mtpl9","mtpl10");
//	defaultOnloadWrapper(defImageLoadTemplArray,'#wrapper','.mtpl27');
//});
//	/**
//	 * Don't know who has written this function. Absolutely no useful comments.  Don't know where it has been used also. Added this comment to atleast differentiate between different functions. -- GK
//	 * 
//	 * @param defImageLoadTemplArray
//	 * @param name
//	 * @param notclass
//	 * @return
//	 */
//	function defaultOnloadWrapper(defImageLoadTemplArray,name,notclass){
//		
//		// Loader
//		//imgs = jQuery('#wrapper img');
////		imgs = jQuery('#wrapper .img_wrapper img');
//		imgs = getParentObject(name);
//		imgArray = new Array();
//		
//		var groupMinJsStr = "";
//		var groupMinCssStr = "";
//		// Initialising hover effect
//		allMtplArray = defImageLoadTemplArray;
//		
//		// Looping through the all mtpl elements
////		for(v=0; v < allMtplArray.length; v++)
////		{
////			// getting the all mtpl elements of each one
////			var mtplArray = jQuery("body").find("."+allMtplArray[v]);
////			if(mtplArray.length > 0) {
////				
////				if(v != 0) {
////					groupMinJsStr += ","+ W3FE_BASE_URL +'/prototype/_includes/' + allMtplArray[v] + "/" + allMtplArray[v]+".js";
//////					groupMinCssStr += ","+ W3FE_BASE_URL +'/prototype/_includes/'+ allMtplArray[v] + "/" + allMtplArray[v]+".css";
////				} else {
//////					groupMinJsStr += W3FE_BASE_URL + '/prototype/_includes/'+ allMtplArray[v] + "/" + allMtplArray[v]+".js";
//////					groupMinCssStr += W3FE_BASE_URL + '/prototype/_includes/' + allMtplArray[v] + "/" + allMtplArray[v]+".css";
////				}
////			}
////			
////		}
////		
////		// checking the mtpl element exists or not
////		if(groupMinCssStr != "") {
////			// Adding the corresponding css file dyanamically to head
////			jQuery("head").append('<link rel="stylesheet" type="text/css" href="'+W3FE_BASE_URL+'/min/f='+groupMinCssStr+'" />');
////		}
////		if(groupMinJsStr != "") {		
////			// adding the corresponding js file dyanamically to head
////			jQuery("head").append('<script type="text/javascript" src="'+W3FE_BASE_URL+'/min/f='+groupMinJsStr+'"></script>');
////		}
//		
//		globalTotalImgLen = imgs.length;
//		loadWorkImages(imgs);
//		
//		//alert(imgs.length);
//	}
//	
//	/**
//	 * Don't know who has written this function. Absolutely no comments.  Don't know where it has been used also. Added this comment to atleast differentiate between different functions. -- GK
//	 * 
//	 * @param name
//	 * @return
//	 */
//	function getParentObject(name){
//		return jQuery(name+' .img_wrapper img');
//	}
//	
//	/**
//	 * Don't know who has written this function. Absolutely no comments.  Don't know where it has been used also. Added this comment to atleast differentiate between different functions. -- GK
//	 * 
//	 * @param target
//	 * @return
//	 */
//	function loadWorkImages(target){
//		target.css({'opacity' : .2});
//		var loadArray = new Array();
//		target.each(function(i){
//			loadArray[i] = jQuery(this).attr('src');
//			var loadtarget = jQuery(this).parent();
//			var parent = jQuery(this).parent().parent();
//			var loader = jQuery(this).parent().parent().parent();
//			jQuery(this).remove();
//			parent.css('opacity',0);
//			loader.append('<img src="'+ W3FE_BASE_URL+'/prototype/_images/loader.gif" class="loader" />');			
//			loadImage(parent, loadtarget, loadArray[i]);
//		});
//
//		target.css({opacity: 1});
//	}
//
//	/**
//	 * Don't know who has written this function. Absolutely no useful comments.  Don't know where it has been used also. Added this comment to atleast differentiate between different functions. -- GK
//	 * 
//	 * @param parent
//	 * @param target
//	 * @param url
//	 * @return
//	 */
//	// loading Images
//	function loadImage(parent,target,url){
//		var ieRandom = Math.round(Math.random()*999999);	
//		url = url+"?random="+ieRandom;
//		var targetWidth = jQuery(target).css('width');
//		var targetHeight = jQuery(target).css('height');
//		jQuery('<img />')
//			.attr('src', url)
//			.load(function(){
//				
//				parent.css('opacity',0);				
//				target.prepend(jQuery(this));
//				
//				/**
//				 * If the parent div is not a gallery item div then only the loaders will be removed
//				 */
//				if(parent.attr('class')!='LCSMainGal')
//				jQuery(this).parent().parent().parent().children('img.loader').each(function(){jQuery(this).remove();});
//				
//				/**
//				 * setting the opacity to all the parent divs excluding the gallery items div
//				 */
//				if(parent.attr('class')!='LCSMainGal')
//				parent.animate({opacity: 1}, 300);
//								
//				var imageWidth = jQuery(this).css('width');
//				var imageHeight = jQuery(this).css('height');
//				jQuery(this).attr("alt", "");
////				jQuery(this).attr("width", imageWidth);
////				jQuery(this).attr("height", imageHeight);
//				
//				/**
//				 * Setting the opacity and removing the loaders from the gallery items divs
//				 */
//				globalCounter++;
//				if(globalTotalImgLen==globalCounter){
//					jQuery(".LCSMainGal").animate({opacity: 1}, 300);
//					jQuery(".LCSMainGal").parents('.mtpl28').children('img.loader').each(function(){jQuery(this).remove();});
//				}
//					
//				
//		}).error(function(){
//		});
//	}
//	/**
//	 * Don't know who has written this function. Absolutely no comments.  Don't know where it has been used also. Added this comment to atleast differentiate between different functions. -- GK
//	 * 
//	 * @param c_name
//	 * @param value
//	 * @param expiredays
//	 * @return
//	 */
//	function setCookie(c_name,value,expiredays)
//	{
//		var exdate=new Date();
//		exdate.setDate(exdate.getDate()+expiredays);
//		document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
//	}
//	/**
//	 * Don't know who has written this function. No comments for function.  Don't know where it has been used also. Added this comment to atleast differentiate between different functions. -- GK
//	 * 
//	 * @param check_name
//	 * @return
//	 */
//	function Get_Cookie( check_name ) {
//		// first we'll split this cookie up into name/value pairs
//		// note: document.cookie only returns name=value, not the other components
//		var a_all_cookies = document.cookie.split( ';' );
//		var a_temp_cookie = '';
//		var cookie_name = '';
//		var cookie_value = '';
//		var b_cookie_found = false; // set boolean t/f default f
//
//		for ( i = 0; i < a_all_cookies.length; i++ )
//		{
//			// now we'll split apart each name=value pair
//			a_temp_cookie = a_all_cookies[i].split( '=' );
//
//
//			// and trim left/right whitespace while we're at it
//			cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
//
//			// if the extracted name matches passed check_name
//			if ( cookie_name == check_name )
//			{
//				b_cookie_found = true;
//				// we need to handle case where cookie has no value but exists (no = sign, that is):
//				if ( a_temp_cookie.length > 1 )
//				{
//					cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
//				}
//				// note that in cases where cookie is initialized but no value, null is returned
//				return cookie_value;
//				break;
//			}
//			a_temp_cookie = null;
//			cookie_name = '';
//		}
//		if ( !b_cookie_found )
//		{
//			return null;
//		}
//	}
//	
//	/**
//	 * Contact form JS for onfocus and onblur functionality
//	 */
//		jQuery(document).ready(function()
//		{
//
////				jQuery(".input_text").focus(function()
////			jQuery(".jNiceInput").focus(function()
////				{
////					
////				jQuery(this).val('');
//////					jQuery(this).parent().children("span").css("visibility","hidden");
////
////				});
////
////				jQuery(".jNiceInput").blur(function()
////				{				
////					if(jQuery(this).val() == jQuery(this).attr('title') || jQuery(this).val()=='')
////					jQuery(this).parent().children("span").css("visibility","visible");
////				});
//
//			});
		
	/**
	 * Main menu js
	 */
	jQuery(document).ready(function()
	{
		var addLi = '<li><div class="rightGray"></div></li>';
		jQuery(".main_menu li ul").append(addLi);
		jQuery(".main_menu li ul li:last-child").prev().find(">a").addClass("no_border_bottm");
		jQuery(".main_menu li ul li:last-child").addClass("lastChild");
		jQuery(".main_menu ul li").each(function(){
			if(jQuery(this).children().children("ul").length!=0){
				jQuery(this).children("a").addClass("submenu_arrow");
			}
		});
		
		/* Initiating W3issue tracker*/
		//jQuery().W3IssueReporting({ProjectURL:'http://w3beta.com/pro/mendo/barloworld/',Client:'mendo',Project:'barloworld'});
	});
	
	/**
	 * Click to activate IE fix code
	 */
	var bo_ns_id = 0;

	function startIeFix(){
		
	  if(isIE()){
	    document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
	    
	  }
	}

	function endIeFix(){
	  if(isIE()){
		  
	    document.write('</div>');
	    var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
	    var theCode = theObject.innerHTML;
	    theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"));
//	    alert(theCode);
//	    alert('from IE');
	    document.write(theCode);
	  }
	}

	function isIE(){
	  // only for Win IE 6+
	  // But not in Windows 98, Me, NT 4.0, 2000
	  var strBrwsr= navigator.userAgent.toLowerCase();
	  if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0){
	    if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6){
	      return false;
	    }
	    if(strBrwsr.indexOf("win98") > -1 ||
	       strBrwsr.indexOf("win 9x 4.90") > -1 ||
	       strBrwsr.indexOf("winnt4.0") > -1 ||
	       strBrwsr.indexOf("windows nt 5.0") > -1)
	    {
	      return false;
	    }
	    return true;
	  }else{
	    return false;
	  }
	}
	/**
	 * End of Click to activate IE fix code
	 */
	
//	/**
//	 * For columnizing footer menu. Menus will be rendered from right to left.
//	 */
//	jQuery(document).ready(function(){
//		remainingHeight = '';
//		prevRemainingHeight = '';
//		column = '';
//		defaultHeight = 300;
//		prevHeight = '';
//		footerDivHeight = jQuery('#footer').height();
//		
//		jQuery('#footer>div>div').each(function(index){
//			catHeight = jQuery(this).height();
////			alert('B4'+catHeight);
//			catHeadHeight = jQuery(this).children('h2').height();
//			if(jQuery(this).children('ul').length > 0){
//				if(jQuery(this).children('ul').children('li').length > 0){
//					catHTML = jQuery(this).html();
//					remainingHeight = defaultHeight - catHeight;
////					alert('Remaining:'+remainingHeight);
//					if(jQuery(this).prev().length > 0){
//						prevHeight = jQuery(this).prev().height();
//						prevHTML = jQuery(this).prev().html();
//						prevRemainingHeight = defaultHeight - prevHeight;
//					}
//					if(jQuery(this).next().length > 0){
//						nextHeight = jQuery(this).next().height();
//						nextHTML = jQuery(this).next().html();
//					}
////					alert('Next:'+nextHeight);
//					if(catHeight < remainingHeight && nextHeight < remainingHeight){
//						if(prevHeight < defaultHeight && catHeight < prevRemainingHeight){
//							jQuery(this).prev().append(catHTML);
//							jQuery(this).css({'float':'right'});
//							jQuery(this).remove();
//						}else if(catHeight < remainingHeight && nextHeight < remainingHeight){
//							jQuery(this).css({'float':'right'});
////							alert('After'+jQuery(this).height());
//							if(jQuery(this).next().length > 0){
//								jQuery(this).append(nextHTML);
//								jQuery(this).next().remove();
//								nextHTML = '';
//							}
//						}
//						else{
//							jQuery(this).css({'float':'right'});
//						}
//					}else{
//						jQuery(this).css({'float':'right'});
//					}
//				}
//			}
//			else{
//				jQuery(this).css({'float':'right'});
//			}
//		});
//	});
//	
