// var $ = jQuery.noConflict(); 

	/* Top Nav load START */

	var strUrl = "/imports/menu.aspx";			
	var strPath = document.location.pathname.toLowerCase();
	if(strPath.indexOf("/thegroup") == 0)
		strUrl += "?parent=0";
	else if(strPath.indexOf("/sharesandperformance") == 0)
		strUrl += "?parent=1";
	else if(strPath.indexOf("/news") == 0)
		strUrl += "?parent=2";
	else if(strPath.indexOf("/societyandenvironment") == 0 || strPath.indexOf("/responsiblebusiness") == 0)
		strUrl += "?parent=3";
	else if(strPath.indexOf("/innovation") == 0)
		strUrl += "?parent=4";
	else if(strPath.indexOf("/careercentre") == 0)
		strUrl += "?parent=5";	

	// make the ajax request right away
	$.ajax({
	url: strUrl,
	  success: function(data) {
		$(document).ready(function(){  // as soon as page has loaded, insert into ul#nav
			/*$("ul#nav").html(data);*/			
		});
	  }
	});
	
	/* Top Nav load END */
 
    var arrmovie = new Array();
	var movie;
	arrmovie[0]="/innovation/flashbg/BTplcIL_01.swf";
	arrmovie[1]="/innovation/flashbg/BTplcIL_02.swf";
        arrmovie[2]="/innovation/flashbg/BTplcIL_03.swf";
        arrmovie[3]="/innovation/flashbg/BTplcIL_04.swf";
        arrmovie[4]="/innovation/flashbg/BTplcIL_05.swf";
        arrmovie[5]="/innovation/flashbg/BTplcIL_06.swf";
	arrmovie[6]="/innovation/flashbg/BTplcIL_07.swf";
        arrmovie[7]="/innovation/flashbg/BTplcIL_08.swf";
	arrmovie[8]="/innovation/flashbg/BTplcIL_09.swf";
        arrmovie[9]="/innovation/flashbg/BTplcIL_10.swf";
	
	function GetRandomVideo(){
	   if(arrmovie==null || arrmovie.length == 0) return;
	   var iRandomMovieIndex=Math.floor(Math.random()*10);
	   movie = arrmovie[iRandomMovieIndex];	
	   var oDiv = document.getElementById("flashbg");
	   if(oDiv){
			oDiv.innerHTML = GetVideoCode();
		}	
	}
    
    function GetVideoCode(){
        var moviecode = "";
        moviecode += "<object height=\"100%\" width=\"100%\" id=\"Shockwaveflash1\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\">";
        moviecode += "<param name=\"FlashVars\" value=\"\" />";
        moviecode += "<param name=\"Movie\" value=\""+ movie +"\" />";
        moviecode += "<param name=\"Src\" value=\""+ movie +"\" />";
        moviecode += "<param name=\"WMode\" value=\"transparent\" />";
        moviecode += "<param name='Scale' value='exactfit'>";
        moviecode += "<span style=\"display:none;\" id=\"ALT_Shockwaveflash1\">Alternative content for Shockwaveflash1</span>";
        moviecode += "<!--if !IE]>-->";
        moviecode += " <object height=\"100%\" width=\"100%\" type=\"application/x-shockwave-flash\" data=\""+ movie + "\">";
        moviecode += "<param name=\"quality\" value=\"high\" />";
        moviecode += "<param name=\"src\" value=\"" + movie +"\" />";
        moviecode += "<param name=\"pluginurl\" value=\"http://www.macromedia.com/go/getflashplayer\" />";
   	    moviecode += "<param name=\"wmode\" value=\"transparent\">";  
   	    moviecode += "<param name='scale' value='exactfit'>"; 
        moviecode += "<span style=\"display:none;\" id=\"ALT_Shockwaveflash2\">Alternative content for Shockwaveflash1</span>";
        moviecode += "</object>";
        moviecode += "<!--<![endif]-->";       
        moviecode += "</object>";
        return moviecode;
    }

	var arrBG = new Array();
	arrBG[0]="<img id=\"background\" width=\"481\"  alt=\"background\"  height=\"575\" src=\"/thegroup/backgrounds/background1.jpg\"/>";
	arrBG[1]="<img id=\"background\" width=\"481\"  alt=\"background\"  height=\"575\" src=\"/thegroup/backgrounds/background2.jpg\"/>";
	arrBG[2]="<img id=\"background\" width=\"481\"  alt=\"background\"  height=\"575\" src=\"/thegroup/backgrounds/background3.jpg\"/>";
	function GetRandomBG(){
	if(arrBG==null || arrBG.length == 0) return;
		var oDiv = document.getElementById("thegroupbackground");
		var iRandomBGIndex=Math.floor(Math.random()*3);
		if(oDiv){
		return oDiv.innerHTML = arrBG[iRandomBGIndex];
		}
	}
       
function popitup(url, width, height) {
	newwindow=window.open(url,'name','height='+height+',width='+width);
	if (window.focus) {newwindow.focus()}
	newwindow.moveTo(500,300);
	return false;
}

var flashvars = {}; 
var params = {}; 
var attributes = {};

$(document).ready(
        function(){ 
       
        if($("#innovationBlogLatest").length > 0)
        {
	   $("#innovationBlogLatest").load("/thegroup/blogengine/default.aspx a.taggedlink:first", function() { $("#innovationBlogLatest a").attr("href", "/thegroup/blogengine/default.aspx") });
        }

	/*
	Search box (autocomplete etc.)
	*/
	$("#searchtext").val("Search");
	$("#searchtext").focus(function () { if($("#searchtext").val() == "Search") { $("#searchtext").val(""); } });
	$("#searchtext").autocomplete("/search/autocomplete_ajax.cfm");
	$("#searchgo").click(function () { if($("#searchtext").val() == "Search") { $("#searchtext").val(""); } });
	$("#searchgo").keydown(function () { if($("#searchtext").val() == "Search") { $("#searchtext").val(""); } });


        $("#searchtextbox").autocomplete("/search/autocomplete_ajax.cfm");
	$("#simpleSearchBox").autocomplete("/search/autocomplete_ajax.cfm");
	

           
	/*
	For  society and env promo IE6.0 only since it doesn't respond to li:hover
	*/ 

	if(jQuery.browser.version == 6.0 &&  jQuery.browser.msie)
	{
	$("#societypromo ul li ul li").css("border", "4px solid white");
	$("#societypromo ul li ul li").hover(
	    function(){
			$(this).css("border", "4px solid violet");
	},

	function(){
		    $("#societypromo ul li ul li").css("border", "4px solid white");
	}   

	);


	$("#societypromo li#item1").hover(
	function(){
		
			$("#societypromo ul li ul#itemul1").show();
			$("#societypromo ul li#item1").css("background-color", "white");
	},

	function(){
	}           
	);
	$("#societypromo li#item2").hover(
	function(){
			$("#societypromo ul li ul#itemul2").show();
			$("#societypromo ul li#item2").css("background-color", "white");
	},

	function(){
		    $("#societypromo ul li ul#itemul2").hide();
		    $("#societypromo ul li").css("background-color", "#dcdada");
			$("#societypromo ul li ul li").css("background-color", "white");
		    $("#societypromo ul li ul#itemul1").show();
			$("#societypromo ul li#item1").css("background-color", "white");
	}           
	);
	$("#societypromo li#item3").hover(
	function(){
			$("#societypromo ul li ul#itemul3").show();
			$("#societypromo ul li#item3").css("background-color", "white");
	},

	function(){
		    $("#societypromo ul li ul#itemul3").hide();
		    $("#societypromo ul li").css("background-color", "#dcdada");
			$("#societypromo ul li ul li").css("background-color", "white");
		    $("#societypromo ul li ul#itemul1").show();
			$("#societypromo ul li#item1").css("background-color", "white");
	}           
	);
	$("#societypromo li#item4").hover(
	function(){
			$("#societypromo ul li ul#itemul4").show();
			$("#societypromo ul li#item4").css("background-color", "white");
	},

	function(){
		    $("#societypromo ul li ul#itemul4").hide();
		    $("#societypromo ul li").css("background-color", "#dcdada");
			$("#societypromo ul li ul li").css("background-color", "white");
		    $("#societypromo ul li ul#itemul1").show();
			$("#societypromo ul li#item1").css("background-color", "white");
	}           
	);
	$("#societypromo li#item5").hover(
	function(){
			$("#societypromo ul li ul#itemul5").show();
			$("#societypromo ul li#item5").css("background-color", "white");
	},

	function(){
		    $("#societypromo ul li ul#itemul5").hide();
		    $("#societypromo ul li").css("background-color", "#dcdada");
			$("#societypromo ul li ul li").css("background-color", "white");
		    $("#societypromo ul li ul#itemul1").show();
			$("#societypromo ul li#item1").css("background-color", "white");
	}           
	);
	$("#societypromo li#item6").hover(
	function(){
			$("#societypromo ul li ul#itemul6").show();
			$("#societypromo ul li#item6").css("background-color", "white");
	},

	function(){
		    $("#societypromo ul li ul#itemul6").hide();
		    $("#societypromo ul li").css("background-color", "#dcdada");
			$("#societypromo ul li ul li").css("background-color", "white");
		    $("#societypromo ul li ul#itemul1").show();
			$("#societypromo ul li#item1").css("background-color", "white");
	}           
	);

	$("#societypromo li#item7").hover(
	function(){
			$("#societypromo ul li ul#itemul7").show();
			$("#societypromo ul li#item7").css("background-color", "white");
	},

	function(){
		    $("#societypromo ul li ul#itemul7").hide();
		    $("#societypromo ul li").css("background-color", "#dcdada");
			$("#societypromo ul li ul li").css("background-color", "white");
		    $("#societypromo ul li ul#itemul1").show();
			$("#societypromo ul li#item1").css("background-color", "white");
	}           
	);

	}

         
         $("#societypromo ul li.default").css("background-color","white");
       
       
	 $("#societypromo ul li.general").hover(
		 function(){
			$("#societypromo ul li.default").css("background-color","#dcdada");
		  },
		  function(){
			
		  }
	  );
	  $("#societypromo").hover(
		 function(){
			
		  },
		  function(){
			$("#societypromo ul li.default").css("background-color","white");
		  }
	  );
	  
	  $("#societypromo ul li.default").hover(
		 function(){
			$("#societypromo ul li.default").css("background-color","white");
		  },
		  function(){
			
		  }
	  );


             
           		       /* 
              Start fash bg
            */
        
            $("a#changebackground").click(
			
			    function(){
				$("#flashbg").css("display", "block");
                   /*$("#flashbg").show();
                   $("#flashbg").fadeTo("fast", 0.0); */
                },
                function(){
	
                }
			
			);
			 
			 
            /* 
              Stop fash bg
            */
        
            $("a#stopbutton ").click(
			
			    function(){
				$("#flashbg").css("display", "none");
                   /* $("#flashbg").hide();
                  $("#flashbg").fadeTo("fast", 0.0); */
			
                },
                function(){
	
                }
			
			);
			






	
    });
    
    
    
    
