
function getCalendarDate()
{

   var weekday=new Array(7)
   weekday[0]="Sunday"
   weekday[1]="Monday"
   weekday[2]="Tuesday"
   weekday[3]="Wednesday"
   weekday[4]="Thursday"
   weekday[5]="Friday"
   weekday[6]="Saturday"

   var months = new Array(13);
   months[0]  = "January";
   months[1]  = "February";
   months[2]  = "March";
   months[3]  = "April";
   months[4]  = "May";
   months[5]  = "June";
   months[6]  = "July";
   months[7]  = "August";
   months[8]  = "September";
   months[9]  = "October";
   months[10] = "November";
   months[11] = "December";
   var now         = new Date();
   var monthnumber = now.getMonth();
   var monthname   = months[monthnumber];
   var daynumber     = now.getDay();
   var dayname     = weekday[daynumber];
   var monthday    = now.getDate();
   var year        = now.getYear();
   if(year < 2000) { year = year + 1900; }
   var dateString = dayname + 
		    ' ' +
		    monthday +
                    ' ' +
                    monthname +
                    ' ' +
                    year;
   return dateString;
} // function getCalendarDate()

function getClockTime()
{
   var now    = new Date();
   var hour   = now.getHours();
   var minute = now.getMinutes();
   var second = now.getSeconds();
   var ap = "am";
   if (hour   > 11) { ap = "pm";             }
   if (hour   > 12) { hour = hour - 12;      }
   if (hour   == 0) { hour = 12;             }
   //if (hour   < 10) { hour   = "0" + hour;   }
   if (minute < 10) { minute = "0" + minute; }
   if (second < 10) { second = "0" + second; }
   var timeString = hour +
                    ':' +
                    minute + '' + ap;
//                    ':' +
//                    second +
//                    "   " //+
//                    ap;
   return timeString;
} // function getClockTime()


function DateTime(){
	
	document.getElementById('DateTime').innerHTML = "<span class='DateTime'><b>" + getClockTime() + "</b> " + getCalendarDate().toUpperCase() + "</span>";
}


function PrintFriendly(Section, Content) { 

	var txt='<link href="StyleSheets/McQueen.css" type="text/css" rel="stylesheet" />'	
	var txt='<style type=text/css>.sectorGraph{width:600px}</style>'	
	txt += '<style type=text/css>TD{ font-size:11px; } Body{ background-color: #FFFFFF; color: #000000}</style><span class=PrintFriendly_SiteName>McQueen - Independent Corporate Finance Advisers</span><br><br><br>';
	txt += '<span class=PrintFriendly_Section>' + Section + '</span><br><br><br>';
	txt += Content;

	winStats='toolbar=no,location=no,directories=no,menubar=no,'
	winStats+='scrollbars=yes,width=485,height=475'
	if (navigator.appName.indexOf("Microsoft")>=0) {
		winStats+=',left=10,top=25'
	}else{
		winStats+=',screenX=10,screenY=25'
	}

	floater=window.open("","",winStats)     
	floater.document.open();
	floater.document.write(txt);
	floater.document.close()
	floater.focus()

	if (window.print) floater.print();
	else if (navigator.appName.indexOf('Microsoft') !=-1) VBPrint()
		setTimeout('floater.close()',1000);
		floater.close();

	
}  

function samplegraph(){
	hideLayer('scrollingContent');
	hideLayer('SectionImage');
	showLayer('SampleGraph');
}

function init(currentPage, currentSubPage){

	var timer=null;

	//set logo link through to home page
	document.getElementById('McQueenLogo').onclick = function () { NavigateTo("default");};

	//set sectorIndices link
	if(currentPage == 'Home'){
		document.getElementById('SectorIndices').onclick = function () { NavigateTo("SectorIndices");};
	}

	//First set the currentPage to highlighted
	var control = "Menu_" + currentPage + "_Button";

	try{
		document.getElementById(control).src="images/Menu_" + currentPage + "_On.gif";
	}catch(err){}

	//set the currentSubP	age to highlighted
	var control = "SubMenu_AboutUs_Button_" + currentSubPage;
	var control2 = "SubMenu_News_Button_" + currentSubPage;

	try{
		document.getElementById(control).src="images/SubMenu_AboutUs_" + currentSubPage + "_On.gif";
	}catch(err){}


try{
		document.getElementById(control2).src="images/SubMenu_News_Button_" + currentSubPage + "_On.gif";
	
}catch(err){}


	if(currentSubPage != 'NewsSub1'){

		document.getElementById('SubMenu_News_Button_NewsSub1').onmouseover = function () { clearTimeout(timer);this.src="images/SubMenu_News_Button_NewsSub1_On.gif";};
		document.getElementById('SubMenu_News_Button_NewsSub1').onmouseout = function () { this.src="images/SubMenu_News_Button_NewsSub1.gif";};
		document.getElementById('SubMenu_News_Button_NewsSub1').onclick = function () { NavigateTo("Press");};

	}
	if(currentSubPage != 'NewsSub2'){

		document.getElementById('SubMenu_News_Button_NewsSub2').onmouseover = function () { clearTimeout(timer);this.src="images/SubMenu_News_Button_NewsSub2_On.gif";};
		document.getElementById('SubMenu_News_Button_NewsSub2').onmouseout = function () { this.src="images/SubMenu_News_Button_NewsSub2.gif";};
		document.getElementById('SubMenu_News_Button_NewsSub2').onclick = function () { NavigateTo("Articles");};

	}



	if(currentSubPage != 'Sub1'){

		document.getElementById('SubMenu_AboutUs_Button_Sub1').onmouseover = function () { clearTimeout(timer);this.src="images/SubMenu_AboutUs_Sub1_On.gif";};
		document.getElementById('SubMenu_AboutUs_Button_Sub1').onmouseout = function () { this.src="images/SubMenu_AboutUs_Sub1.gif";};
		document.getElementById('SubMenu_AboutUs_Button_Sub1').onclick = function () { NavigateTo("SectorKnowledge");};

	}
	if(currentSubPage != 'Sub2'){
		document.getElementById('SubMenu_AboutUs_Button_Sub2').onmouseover = function () { clearTimeout(timer);this.src="images/SubMenu_AboutUs_Sub2_On.gif";};
		document.getElementById('SubMenu_AboutUs_Button_Sub2').onmouseout = function () { this.src="images/SubMenu_AboutUs_Sub2.gif";};
		document.getElementById('SubMenu_AboutUs_Button_Sub2').onclick = function () { NavigateTo("InnovativeThinking");};
	}
	if(currentSubPage != 'Sub3'){
		document.getElementById('SubMenu_AboutUs_Button_Sub3').onmouseover = function () { clearTimeout(timer);this.src="images/SubMenu_AboutUs_Sub3_On.gif";};
		document.getElementById('SubMenu_AboutUs_Button_Sub3').onmouseout = function () { this.src="images/SubMenu_AboutUs_Sub3.gif";};
		document.getElementById('SubMenu_AboutUs_Button_Sub3').onclick = function () { NavigateTo("IntelligentExecution");};
	}


	//set SubMenu functionality
	document.getElementById('SubMenu_AboutUs_Sub1').onmouseout = function () { document.getElementById('SubMenuHolder').style.visibility = 'visible';};
	document.getElementById('SubMenu_AboutUs_Sub2').onmouseout = function () { document.getElementById('SubMenuHolder').style.visibility = 'visible';};
	document.getElementById('SubMenu_AboutUs_Sub3').onmouseout = function () { document.getElementById('SubMenuHolder').style.visibility = 'visible';};
	document.getElementById('SubMenuHolder').onmouseover = function () { clearTimeout(timer);document.getElementById('SubMenuHolder').style.visibility = 'visible';document.getElementById('Menu_AboutUs_Button').src="images/Menu_AboutUs_On.gif"};
	document.getElementById('SubMenuHolder').onmouseout = function () { timer=setTimeout(hideSubMenu, 300);};


	//set SubMenu functionality
	document.getElementById('SubMenu_News_Sub1').onmouseout = function () { document.getElementById('SubMenuHolder2').style.visibility = 'visible';};
	document.getElementById('SubMenu_News_Sub2').onmouseout = function () { document.getElementById('SubMenuHolder2').style.visibility = 'visible';};
	document.getElementById('SubMenuHolder2').onmouseover = function () { clearTimeout(timer);document.getElementById('SubMenuHolder2').style.visibility = 'visible';document.getElementById('Menu_LatestNews_Button').src="images/Menu_LatestNews_On.gif"};
	document.getElementById('SubMenuHolder2').onmouseout = function () { timer=setTimeout(hideSubMenu2, 300);};

	if(currentPage != 'Home'){
		document.getElementById('Menu_Home_Button').onmouseover = function () { this.src="images/Menu_Home_On.gif";document.getElementById('SubMenuHolder').style.visibility = 'visible';};
		document.getElementById('Menu_Home_Button').onmouseout = function () { this.src="images/Menu_Home.gif";timer=setTimeout(hideSubMenu, 300)};
		document.getElementById('Menu_Home_Button').onclick = function () { NavigateTo("default")};
		document.getElementById('SubMenuHolder').style.visibility = 'hidden';
	}else{
		document.getElementById('Menu_AboutUs_Button').onmouseover = function () { this.src="images/Menu_AboutUs_On.gif";document.getElementById('SubMenuHolder').style.visibility = 'visible';};

		
	}

	if(currentPage != 'AboutUs'){
		document.getElementById('Menu_AboutUs_Button').onmouseover = function () { this.src="images/Menu_AboutUs_On.gif";document.getElementById('SubMenuHolder').style.visibility = 'visible';};
		document.getElementById('Menu_AboutUs_Button').onmouseout = function () { this.src="images/Menu_AboutUs.gif";timer=setTimeout(hideSubMenu, 300)};
		document.getElementById('Menu_AboutUs_Button').onclick = function () { NavigateTo("AboutUs")};
		document.getElementById('SubMenuHolder').style.visibility = 'hidden';
	}else{
		document.getElementById('Menu_AboutUs_Button').onmouseover = function () { this.src="images/Menu_AboutUs_On.gif";document.getElementById('SubMenuHolder').style.visibility = 'visible';};

		
	}
	if(currentPage != 'Team'){
		document.getElementById('Menu_Team_Button').onmouseover = function () { this.src="images/Menu_Team_On.gif";hideLayer('SubMenuHolder');};
		document.getElementById('Menu_Team_Button').onmouseout = function () { this.src="images/Menu_Team.gif";};
		document.getElementById('Menu_Team_Button').onclick = function () { NavigateTo("Team")};
	}
	if(currentPage != 'Transactions'){
		document.getElementById('Menu_Transactions_Button').onmouseover = function () { this.src="images/Menu_Transactions_On.gif";hideLayer('SubMenuHolder');};
		document.getElementById('Menu_Transactions_Button').onmouseout = function () { this.src="images/Menu_Transactions.gif";};
		document.getElementById('Menu_Transactions_Button').onclick = function () { NavigateTo("Transactions")};
	}else{
		document.getElementById('Menu_Transactions_Button').onclick = function () { NavigateTo("Transactions")};
	}
	
	if(currentPage != 'SectorIndices'){
		document.getElementById('Menu_SectorIndices_Button').onmouseover = function () { this.src="images/Menu_SectorIndices_On.gif";hideLayer('SubMenuHolder');};
		document.getElementById('Menu_SectorIndices_Button').onmouseout = function () { this.src="images/Menu_SectorIndices.gif";};
		document.getElementById('Menu_SectorIndices_Button').onclick = function () { NavigateTo("SectorIndices")};
	}
	if(currentPage != 'Contact'){
		document.getElementById('Menu_Contact_Button').onmouseover = function () { this.src="images/Menu_Contact_On.gif";hideLayer('SubMenuHolder');};
		document.getElementById('Menu_Contact_Button').onmouseout = function () { this.src="images/Menu_Contact.gif";};
		document.getElementById('Menu_Contact_Button').onclick = function () { NavigateTo("Contact")};
	}

	if(currentPage != 'LatestNews'){
		document.getElementById('Menu_LatestNews_Button').onmouseover = function () { this.src="images/Menu_LatestNews_On.gif";document.getElementById('SubMenuHolder2').style.visibility = 'visible';};
		document.getElementById('Menu_LatestNews_Button').onmouseout = function () { this.src="images/Menu_LatestNews.gif";timer=setTimeout(hideSubMenu2, 300)};
		document.getElementById('Menu_LatestNews_Button').onclick = function () { NavigateTo("News")};
		document.getElementById('SubMenuHolder').style.visibility = 'hidden';
	}else{
		document.getElementById('Menu_LatestNews_Button').onmouseover = function () { this.src="images/Menu_LatestNews_On.gif";document.getElementById('SubMenuHolder2').style.visibility = 'visible';};

		
	}

	
}

function hideSubMenu(){
	hideLayer('SubMenuHolder');	
}
function hideSubMenu2(){
	hideLayer('SubMenuHolder2');	
}

function hideLayer(layerToHide){
	document.getElementById(layerToHide).style.visibility = 'hidden';
}
function showLayer(layerToShow){
	document.getElementById(layerToShow).style.visibility = 'visible';
}

function NavigateTo(page){
	document.location.href= page + "." + "aspx";
}

function PopUp(popurl, width, height){
	var winpops=window.open(popurl,"","width=470,height=460,scrollbars,resizable")
}