// Scrolling Banner Parameters
// ---------------------------

// begin: Belt Conveyer's Parameters - 
//width of the Conveyer in pixels: set to your own; 
//Longer Messages (exceeding width) will slide OK anyway;
var bwidth=380; 

//height of the Conveyer in pixels: set to your own; 
//you may set the height for as many lines as you'd like; 
//"20" is more or less for one line!
var bheight=14; 

//BACKGROUND: either color(1) or image(2) ; 
//1.Background color: could be like: "#ffff00" or "yellow";
//set it "" for no background color;
var bbcolor="";

//or 2.Background image: "imagename.ext";
//leave it "" for no image background;
var bbground="";

//border for sliding area: 1, ... ;
//set it 0(zero) for no border;
var bborder=0;

//speed in pixels: the higher the faster!
var bspeed=1; 

//pause between messages in milliseconds: 1000=1s; set to your own;
var bpause = 4000; 

//speed for exceeding portions in milliseconds: 1000=1s; 
//the higher the slower: set to your own;
//leave it unchanged if no exceeding portions of messages!
//"20" equals the speed to the main portion!
var fpause=20; 

// Vertical Scroller's Parameters
// ------------------------------

// begin: Vertical Scroller's Parameters - 
//width of the Scroller in pixels: set to your own;
var mwidth=149; 

//height of the Scroller in pixels: set to your own; 
//larger Messages (exceeding height) will slide OK anyway, 
// but the exceeding height won't show up on Recall!
var mheight=149; 

//BACKGROUND: either color(1) or image(2) ;
//1.Background color: could be like: "#ffff00" or "yellow";
//set it "" for no background color;
var mcolor="#ccccff";

//or 2.Background image: "imagename.ext";
//leave it "" for no image background;
var mbground="";

//border for scrolling area: 1, ... ;
//set it 0(zero) for no border;
var mborder=0;

//speed in pixels: the higher the faster - set your own!
var mspeed=1; 

//pause between messages in milliseconds: 1000=1s; set to your own; 
var mpause = 1; 

//speed for exceeding portions in milliseconds: 1000=1s;
//the higher the slower: set to your own;
//leave it unchanged if no exceeding portions of messages!
//"20" equals the speed to the main portion!
var epause=1; 

// Crash Functions

function locateElement(pString) {

	if (document.getElementById(pString))
		return document.getElementById(pString)
	else
		return false;
}

function seekChildElement (pElement, pTag) {

	var i = 0;

	for (i=0; i<(pElement.childNodes.length); i+=1) {
		if (pElement.childNodes[i].nodeType == 1) {
			if (pElement.childNodes[i].tagName == pTag) {
				return pElement.childNodes[i];
			}
			else {
				seekChildElement (pElement.childNodes[i]);
			} 
		}
	}
}

function seekParentElement (pElement, pTag) {

	var oElement = pElement.parentElement;
	if (oElement != null) {
		if (oElement.nodeType == 1) {
			if (oElement.tagName == pTag) {
				return oElement;
			}
			else {
				seekParentElement (oElement, pTag);
			} 
		}
	else
		return false;
	}
}

// ---------------------------------

function highlightMenu(pElement) {

	pElement.className = 'menuItemHighlight';
	
}


function highlightMenuSignin(pElement) {

	pElement.className = 'menuItemHighlightSignin';
	
}

function revertMenu(pElement) {

	pElement.className = 'menuItem';
	
}


function revertMenuSignin(pElement) {

	pElement.className = 'menuItemSignin';
	
}

function highlightRow(pElement) {

	if (seekParentElement(pElement, 'TR'))
		seekParentElement(pElement, 'TR').className = 'rowItemHighlight';
	
}

function revertRow(pElement) {

	if (seekParentElement(pElement, 'TR'))
		seekParentElement(pElement, 'TR').className = 'rowItem';
	
}

function clickLink(pElement) {

	var linkElement = seekChildElement(pElement, 'A');
	
	if (linkElement) {
		if (linkElement.click())
			linkElement.click()
		else
			if (linkElement.target.length == 0) {
				window.location = linkElement.href;
				}
	}

}
		
function startscroll() {
	
	var i;
	var lLocation = window.location.href;
	if (lLocation.indexOf('access=full') > -1) {
		var lElements = document.getElementsByTagName('A');
	    for (i = 0; i < lElements.length; i++){  
			if (lElements[i].href.indexOf('?') == -1)
				lElements[i].href = lElements[i].href + "?access=full"
			else
				lElements[i].href = lElements[i].href + "&access=full";
		}
		lElements = document.getElementsByTagName('FORM');
		var oObject
		for (i = 0; i < lElements.length; i++){  
			oObject =  document.createElement("<input type='hidden' name='access' id='access' value='full'>");
			lElements[i].appendChild(oObject);
		}		
	}
	

	if (locateElement('scrolldivh'))
		bscroll();
	if (locateElement('scrolldiv'))		
		vscroll();
	startBlink();
		
}

function getCookie (pName) {

	var result = null;
	var myCookie = " " + document.cookie + ";";
	var searchName = pName + "=";
	var startOfCookie = myCookie.indexOf(searchName);
	var endOfCookie;
	if (startOfCookie != -1) {
		startOfCookie += searchName.length;
		endOfCookie = myCookie.indexOf("&", startOfCookie);
		if (endOfCookie == -1)
			endOfCookie = myCookie.indexOf(";", startOfCookie);
		if (endOfCookie <= startOfCookie)
			endOfCookie = myCookie.length - 1;
		result = unescape(myCookie.substring(startOfCookie, endOfCookie));
	}
	return result;

}

function checkHopper() {

	var oElement = document.getElementById('channelHopper');
	if (oElement.options[0].selected == true)
		return false
	else
		return true;
	
}

function doBlink() {

	var lElements = document.getElementsByName('blink');
	 for (i = 0; i < lElements.length; i++){ 
	 	if(lElements[i].style.visibility == "hidden") {
			lElements[i].style.visibility = "visible"
			}
		else {
			lElements[i].style.visibility = "hidden";
			}
			
	 }
	
}

function startBlink() {
	timerID = setInterval('doBlink()', 750);
}

function openRadio() {
	window.open('/uk/en/services/radio/radioplayer.html', 'crashRadio', 'status');
}

