﻿function tabOnclick()
{
   MM_preloadImages('images/btn_homemo.jpg','images/btn_aboutusmo.jpg','images/btn_productsmo.jpg','images/btn_eventmo.jpg','images/btn_supportsmo.jpg','images/downloadmo.jpg','images/btn_pressroommo.jpg','images/btn_contactmo.jpg');
   var obj= {};
    obj= parseUri(location.protocol + "//" + location.hostname + "" + location.pathname)
	 for (var property in obj)
	 {
		 if (property == "fileName")
		 {
			var filename = obj[property];			
			 if (filename =="index.aspx")
			 {
//                 document.getElementById('tdHome').setAttribute("onmouseover",null);
		         document.getElementById('tdHome').setAttribute("onmouseout",null);
//		         document.getElementById('tdHome').setAttribute("onclick",null);
		         document.getElementById('tdHome').removeAttribute("style");
		         setBackgroundImage ('tdHome', 'images/btn_homemo.jpg');	
			 }
			 else if (filename=="about_us.aspx") 
			 {
//			     document.getElementById('tdAboutUs').setAttribute("onmouseover",null);
		         document.getElementById('tdAboutUs').setAttribute("onmouseout",null);
//		         document.getElementById('tdAboutUs').setAttribute("onclick",null);
    	         document.getElementById('tdAboutUs').removeAttribute("style");
			     setBackgroundImage ('tdAboutUs', 'images/btn_aboutusmo.jpg');	
			 }
			 else if (filename =="product.aspx")
			 {
//			    document.getElementById('tdProducts').setAttribute("onmouseover",null);
		         document.getElementById('tdProducts').setAttribute("onmouseout",null);
//		         document.getElementById('tdProducts').setAttribute("onclick",null);
		         document.getElementById('tdProducts').removeAttribute("style");
			    setBackgroundImage ('tdProducts', 'images/btn_productsmo.jpg');	
			 }
			 else if ((filename =="events.aspx")||(filename =="event_photos.aspx"))
			 {
//			     document.getElementById('tdEventPromotion').setAttribute("onmouseover",null);
		         document.getElementById('tdEventPromotion').setAttribute("onmouseout",null);
//		         document.getElementById('tdEventPromotion').setAttribute("onclick",null);
		         document.getElementById('tdEventPromotion').removeAttribute("style");
			     setBackgroundImage ('tdEventPromotion', 'images/btn_eventmo.jpg');	
			 }
			 else if ((filename =="support.aspx")||(filename =="training.aspx")||(filename =="services.aspx"))
			 {
//			    document.getElementById('tdSupportServices').setAttribute("onmouseover",null);
		         document.getElementById('tdSupportServices').setAttribute("onmouseout",null);
//		         document.getElementById('tdSupportServices').setAttribute("onclick",null);
		         document.getElementById('tdSupportServices').removeAttribute("style");
			     setBackgroundImage ('tdSupportServices', 'images/btn_supportsmo.jpg');	
			 }
			 else if (filename =="download.aspx")
			 {
//	             document.getElementById('tdDownload').setAttribute("onmouseover",null);
                 document.getElementById('tdDownload').setAttribute("onmouseout",null);
//                 document.getElementById('tdDownload').setAttribute("onclick",null);
                 document.getElementById('tdDownload').removeAttribute("style");
	             setBackgroundImage ('tdDownload', 'images/downloadmo.jpg');	
			 }
			 else if (filename =="news.aspx")
			 {
//			    document.getElementById('tdPressRoom').setAttribute("onmouseover",null);
		         document.getElementById('tdPressRoom').setAttribute("onmouseout",null);
//		         document.getElementById('tdPressRoom').setAttribute("onclick",null);
	            document.getElementById('tdPressRoom').removeAttribute("style");
		        setBackgroundImage ('tdPressRoom', 'images/btn_pressroommo.jpg');	
			 }	 
			 else if ((filename =="contact_us.aspx")||(filename =="jobs.aspx"))
			 {
//			    document.getElementById('tdContactUs').setAttribute("onmouseover",null);
		         document.getElementById('tdContactUs').setAttribute("onmouseout",null);
//		         document.getElementById('tdContactUs').setAttribute("onclick",null);
		        document.getElementById('tdContactUs').removeAttribute("style");
			    setBackgroundImage ('tdContactUs', 'images/btn_contactmo.jpg');	
			 }				
		
		 }			 	
 	}	
}

function parseUri(sourceUri){
    var uriPartNames = ["source","protocol","authority","domain","port","path","directoryPath","fileName","query","anchor"];
    var uriParts = new RegExp("^(?:([^:/?#.]+):)?(?://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#]|$)))*/?)?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?").exec(sourceUri);
    var uri = {};
    
    for(var i = 0; i < 10; i++){
        uri[uriPartNames[i]] = (uriParts[i] ? uriParts[i] : "");
    }
    
    // Always end directoryPath with a trailing backslash if a path was present in the source URI
    // Note that a trailing backslash is NOT automatically inserted within or appended to the "path" key
    if(uri.directoryPath.length > 0){
        uri.directoryPath = uri.directoryPath.replace(/\/?$/, "/");
    }
    
    return uri;
}




