var hideTime;
var defaultDiv = 3;
var strActiveScreen = "";

// Flash panel JS - Start
var FlashPanelsActive = false;
var now = new Date();
var maxLoadTime = 7000;
var startTime = now.getTime();
	
function getLoadTime(){
	var now = new Date();
	var endTime = now.getTime();
	var loadTime = 0;
	loadTime = endTime-startTime;
	return loadTime;
}

function enableFlashPanels(){
	var loadTime = getLoadTime();
	if(loadTime<maxLoadTime){
		//Enable flash rollovers
		FlashPanelsActive = true;
	}
}

// Flash panel JS - End
function changeStage(strScreen, strLink, objPanel) {
	if(FlashPanelsActive) {
		if (strActiveScreen != strScreen) {
			if (document.getElementById("text-" + strScreen) && document.getElementById("img-" + strScreen)) {
				
				if (strScreen != 'dedicated' && strScreen != 'broadband')
					document.getElementById("homeStage").style.backgroundImage = 'url(/pics/homepagebanners/' + strScreen + '.jpg)';
				else
					document.getElementById("homeStage").style.backgroundImage = 'url(/pics/homepagebanners/' + strScreen + '.gif)';
				document.getElementById("homeStage-text").innerHTML = document.getElementById("text-" + strScreen).innerHTML;
	
				document.getElementById("slideHdr").innerHTML = document.getElementById("img-" + strScreen).innerHTML;
				document.getElementById("homeStage-link").href = strLink;
				
				var fo = new FlashObject("/pics/homepagebanners/" + strScreen + ".swf", "domainflash", "450", "220", "7");
				fo.addParam("wmode", "transparent")
				fo.write("flashpanel");	
				
				strActiveScreen = strScreen;
			}
		}
	}
	
	if (objPanel) {
		objPanel.className = 'sectionPanelHover';
		objPanel.onmouseout = function() {
			objPanel.className = 'sectionPanel';
		}
	}
}

/*
function handleMouseOver(intDivId, intPanelId) {
	if(FlashPanelsActive) {
		objDiv = document.getElementById("stageSlide" + intDivId);
		objDiv.style.display = "block";
		
		if(prevDiv.id != objDiv.id) hideDiv();
		prevDiv = objDiv;
		//window.clearTimeout(hideTime);
	}	
		intPanel = (intPanelId) ? intPanelId : intDivId;
		objPanel = document.getElementById("panel" + intPanel);
		if(objPanel) objPanel.className = 'sectionPanelHover';
	
}

function handleMouseOut(intDivId) {
	//hideTime = window.setTimeout("hideDiv();", 2000);
	if(intDivId) document.getElementById("panel" + intDivId).className = 'sectionPanel';
}

function hideDiv() {
	if (prevDiv){
		prevDiv.style.display = 'none';	
		prevDiv = "";
		//window.setTimeout("reset();", 20);
	}
}

function reset() {
	if (prevDiv == ""){
		handleMouseOver(defaultDiv);
	}
}

function start() {
	prevDiv = document.getElementById("stageSlide"+defaultDiv);
	
}

var prevDiv = document.getElementById("stageSlide" + defaultDiv);


function highlightPanel(intDivId) {
	objPanel = document.getElementById("panel" + intDivId);
	if(objPanel) objPanel.className = 'sectionPanelHover';
}
*/



/***********************************
*   http://javascripts.vbarsan.com/
*   This notice may not be removed 
***********************************/

//-- Begin Scroller's Parameters and message -->
//scroller width: change to your own;
var swidth=200;

//scroller height: change to your own;
var sheight=175;

//background color: change to your own; 
var sbcolor="#ffffff";

//scroller's speed: change to your own;
var sspeed=1;
var restart=sspeed;
rspeed=sspeed;

//text: change to your own

wholemessage='<div align="left" class=tabb><p class=txt11ptredbold>Convergenic now sells the <br>T-Mobile Business 1-Plan</p> <p class=txt11ptblue>The Business 1-Plan is the most tailored proposition for SMEs, making your’ money go further by giving you:<br><br>Free calls between the mobiles on the same account.<br><br>Free calls between the office and employee mobiles.<br><br>Calls to other mobiles from the office costing as little as 4p per minute (Typical 70% saving!!!).<br><br>Calls to Europe and North America within inclusive minutes.<br><br>Free Blackberry handsets with mobile e mail.<br><br> <!-- <a href="">Click here for more</a> --></p></div>';
//-- end Parameters and message -->

//-- begin: Scroller's Algorithm -->
function goup(){if(sspeed!=rspeed*8){sspeed=sspeed*2;restart=sspeed;}}
function godown(){if(sspeed>rspeed){sspeed=sspeed/2;restart=sspeed;}}
function start(){if(document.all) iemarquee(slider);else if(document.getElementById)ns6marquee(document.getElementById('slider'));else if(document.layers)ns4marquee(document.slider1.document.slider2);}function iemarquee(whichdiv){iediv=eval(whichdiv);iediv.style.pixelTop=sheight;iediv.innerHTML=wholemessage;sizeup=iediv.offsetHeight;ieslide();}function ieslide(){if(iediv.style.pixelTop>=sizeup*(-1)){iediv.style.pixelTop-=sspeed;setTimeout("ieslide()",100);}else{iediv.style.pixelTop=sheight;ieslide();}}function ns4marquee(whichlayer){ns4layer=eval(whichlayer);ns4layer.top=sheight;ns4layer.document.write(wholemessage);ns4layer.document.close();sizeup=ns4layer.document.height;ns4slide();}function ns4slide(){if(ns4layer.top>=sizeup*(-1)){ns4layer.top-=sspeed;setTimeout("ns4slide()",100);}else{ns4layer.top=sheight;ns4slide();}}function ns6marquee(whichdiv){ns6div=eval(whichdiv);ns6div.style.top=sheight;ns6div.innerHTML=wholemessage;sizeup=ns6div.offsetHeight;ns6slide();}function ns6slide(){if(parseInt(ns6div.style.top)>=sizeup*(-1)){ns6div.style.top=parseInt(ns6div.style.top)-sspeed;setTimeout("ns6slide()",100);}else{ns6div.style.top=sheight;ns6slide();}}
//-- end Algorithm -->






/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename);
if ((cookievalue!=""))
{
//alert(cookievalue);
document.getElementById(cookievalue).style.display="block"
}
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate



/*
*	Function to show and hide the content on A to Z jargon on Support page.
*	
*   Depending on the character clicked (A to Z) on the page, the section specific
*   to that character is shown.
*/
function showhidecontent(divId)
{

	//Get the Div Style of the Id passed.
	var divStyle = document.getElementById(divId).style;
	
	
	var alphabhets = new Array();
	alphabhets[0] = 'A';
	alphabhets[1] = 'B';
	alphabhets[2] = 'C';
	alphabhets[3] = 'D';
	alphabhets[4] = 'E';
	alphabhets[5] = 'F';
	alphabhets[6] = 'G';
	alphabhets[7] = 'H';
	alphabhets[8] = 'I';
	alphabhets[9] = 'J';
	alphabhets[10] = 'K';
	alphabhets[11] = 'L';
	alphabhets[12] = 'M';
	alphabhets[13] = 'N';
	alphabhets[14] = 'O';
	alphabhets[15] = 'P';
	alphabhets[16] = 'Q';
	alphabhets[17] = 'R';
	alphabhets[18] = 'S';
	alphabhets[19] = 'T';
	alphabhets[20] = 'U';
	alphabhets[21] = 'V';
	alphabhets[22] = 'W';
	alphabhets[23] = 'X';
	alphabhets[24] = 'Y';
	alphabhets[25] = 'Z';
	
	for (i=0; i < alphabhets.length; i++)
	{		
		if (divId == alphabhets[i])
		{
			document.getElementById(alphabhets[i]).style.visibility = 'visible';
		}
		else
		{
			document.getElementById(alphabhets[i]).style.visibility = 'hidden';
		}
	}
}


//Show and Hide Menus
var services = 'Services';
var support = 'Support';

function ShowHideMenus(menuId)
{
	if (menuId == services)
	{
		document.getElementById(services).style.visibility = 'visible';
		document.getElementById(support).style.visibility = 'hidden';
	}
	else if (menuId  == support)
	{
		document.getElementById(support).style.visibility = 'visible';
		document.getElementById(services).style.visibility = 'hidden';
	}
	else
	{
		document.getElementById(support).style.visibility = 'hidden';
		document.getElementById(services).style.visibility = 'hidden';
	}
}

//Show and hide child menus, when user mouseovers the parent menu.
function changeImage(imageName, image)
{
	document.images[imageName].src=image;
}

//Store the child menus using cookies.

function storeChildMenus(menuId)
{
	document.cookie = "Menu=" + menuId;
}


function paintMenus()
{
	var cookie = document.cookie;
	var menu = cookie.substring(cookie.indexOf("=")+1,cookie.indexOf(";"));
	
	if ((menu != null) && (menu != -1))
	{
		ShowHideMenus(menu)
	}
	
	if (menu == 'Services')
	{
		document.getElementById('ParentServices').style.color = 'black'; 
		document.getElementById('ParentServices').style.textDecoration = 'underline';
	}
	else if (menu  == 'Support')
	{
		document.getElementById('ParentSupport').style.color = 'black'; 
		document.getElementById('ParentSupport').style.textDecoration = 'underline';
	}
}

function RemoveCookie()
{
	//alert("unload fired");
	//document.cookie = "Menu=''";
}


function putDate(){
calendar = new Date();
day = calendar.getDay();
month = calendar.getMonth();
date = calendar.getDate();
year = calendar.getYear();

var dayname = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var monthname = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" );
document.write(dayname[day] + " - ");
document.write(monthname[month] + " ");
if (date < 10) document.write(date + ", ");
	else document.write(date + ", ");
if (year < 100)	document.write("19" + year + " "); 
	else if (year > 1999) document.write(year + " ");
document.write("<font color=804040>");

/*if ((month == 0) && (date == 1)) document.write("New Years Day");
if ((month == 0) && (day == 1) && (date > 14) && (date < 23)) document.write("Martin Luther King's Birthday");
if ((month == 1) && (date == 12)) document.write("Lincoln's Birthday");
if ((month == 1) && (date == 14)) document.write("Valentine's Day");
if ((month == 1) && (day == 1) && (date > 14) && (date < 22)) document.write("President's Day");
if ((month == 1) && (date == 22) && (day == 1)) document.write("President's Day<BR>");
if ((month == 1) && (date == 22)) document.write("Washington's Birthday");
if ((month == 2) && (date == 17)) document.write("St. Patrick's Day");
if ((month == 3) && (day == 0) && (date > 0) && (date < 8)) document.write("Daylight Savings Time Begins");
if ((month == 4) && (day == 0) && (date > 7) && (date < 16)) document.write("Mother's Day");
if ((month == 4) && (day == 1) && (date > 24)) document.write("Memorial Day");
if ((month == 5) && (date == 14)) document.write("Flag Day");
if ((month == 5) && (day == 0) && (date > 15) && (date < 24)) document.write("Father's Day");
if ((month == 6) && (date == 4)) document.write("Independence Day");
if ((month == 8) && (day == 1) && (date > 0) && (date < 8)) document.write("Labor Day");
if ((month == 9) && (day == 1) && (date > 7) && (date < 16)) document.write("Columbus Day, ");
if ((month == 9) && (day == 0) && (date > 24) && (date < 31)) document.write("Daylight Savings Time Ends");
if ((month == 9) && (day == 0) && (date == 31)) document.write("Daylight Savings Time Ends<BR>");
if ((month == 9) && (date == 31)) document.write("Halloween");
if ((month == 10) && (date == 11)) document.write("Veteran's Day");
if ((month == 10) && (day == 4) && (date > 23) && (date < 30)) document.write("Thanksgiving");
if ((month == 10) && (date == 30) && (day == 4)) document.write("Thanksgiving");
if ((month == 11) && (date == 24)) document.write("X-mas Eve");
if ((month == 11) && (date == 25)) document.write("X-mas");
if ((month == 11) && (date == 31)) document.write("New Year's Eve");
if ((month == 9) && (date == 5)) document.write("<a class=hol href='http://www.chabad.org'>Sukkos (Jewish Holiday)</a>");
if ((month == 9) && (date == 12)) document.write("Sh'mini Atzeret (Jewish Holiday)");
if ((month == 9) && (date == 13)) document.write("Simchat Torah (Jewish - Israel Holiday)");
if ((month == 11) && (date == 14)) document.write("Hannukah (Jewish Holiday)");
if ((month == 1) && (date == 1)) document.write("Tu B'Shvat (Jewish - Israel Holiday)");
if ((month == 2) && (date == 2)) document.write("Purim (Jewish - Israel Holiday)");
if ((month == 3) && (date == 1)) document.write("Passover (Jewish Holiday)");
document.write("</font>");
*/}


