jQuery(document).ready(function(){
        var caller=gup('CBB2E');
		menutab = gup('R001');
        //Make an Array to hold more than value on the return
        var appinfo= new Array();
		appinfo=checkApp(caller);
        //Set Menu active status for Main and sub-navigation
        Original(appinfo);
		callQR();
}); 
function callQR(){
    var url=document.URL;
	url=encodeURIComponent(url);
    var fullUrl="https://chart.googleapis.com/chart?chs=120x120&cht=qr&chl="+url;
    jQuery("#QR").attr("src",fullUrl);
}
function Original(appinfo){
		//Hide all sub-nav menu bars
		jQuery('#homebar').hide();
		jQuery('#retbar').hide();
		jQuery('#rptbar').hide();
		jQuery('#bibar').hide();
		jQuery('#mntbar').hide();
		jQuery('#b2bbar').hide();
		jQuery('#mrcmenubar').hide();
		//Set correct Main menu option
		jQuery(appinfo[0]).attr('id','active');		
		jQuery(appinfo[1]).attr('class','active_sub');
		jQuery(appinfo[2]).show();
}
//Get App from URL
function gup( name ){
		  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
		  var regexS = name+".([^&#?]*)";
		  var regex = new RegExp( regexS );
		  var results = regex.exec( window.location.href );
		  if( results == null )
			return "";
		  else
			return results[1];
}
//Check App in this List
function checkApp(application){
	if (application=='I00010s' || application=='I00020s' || application=='I00031s')
		return [".ret","#DataListing","#retbar"];
	if (application=='I00030s')
		return [".ret","#WebScheduling","#retbar"];	
	if (application=='I00190s')
		return [".ret","#GoogleMap","#retbar"];	
	if (application=='R00070s' || application=='I00009s')
		return [".rpt","#AdHoc","#rptbar"];	
	if (application=='R00060s' || application=='R00030s' || application=='R00040s' || application=='R00050s')
		return [".rpt","#DrillDown","#rptbar"];
	if (application=='R00160s')
		return [".rpt","#Ranking","#rptbar"];
	if (application=='R01231s')
		return [".bi","#Dash","#bibar"];
	if (application=='R00180s')
		return [".bi","#Pivot","#bibar"];
	if (application=='R00090s')
		return [".bi","#Interactive","#bibar"];
	if (application=='R00190s')
		return [".bi","#WhatIf","#bibar"];
	if (application=='M00020s')
		return [".mnt","#CRUD","#mntbar"];
	if (application=='M00070s')
		return [".mnt","#Update","#mntbar"];
	if (application=='I00500s' || application=='M00502s' || application=='M00510s' || application=='M00501s' || application=='M00506s' || application=='M00500s')
		return [".mnt","#OrderEntry","#mntbar"];	
	if (application=='R00170s')
		return [".mnt","#DragDrop","#mntbar"];
	if (application=='M07050s')
		return ["blank","blank","blank"];
	if (application=='' || application=='Menus')
		return [".home","#home2","#homebar"];
	if (application=='mrcMenu' && (menutab=='Customer%20Service' || menutab==''))
		return [".home","#mrcmenu","#mrcmenubar"];
	if (application=='mrcMenu' && menutab=='Executive')
		return [".home","#mrcmenu2","#mrcmenubar"];
	}
