// JavaScript Document
if (window.self != window.top) window.top.location = window.self.location; 

function submitForm(i){
	document.forms[i].submit();
}

function submitnewwindow(url){
	document.fmMail.target='_self';
	document.fmMail.submit();
}

function launchNewsConsole(){
 var consoleWindow=window.open("http://news.bbc.co.uk/go/syn/brightview/broadband/news/-/broadband/news_console.stm?source=brightview","consoleWindow","width=671,height=405 toolbar=0,location=0,menubar=0,scrollbars=0,status=0");
   consoleWindow.focus();
}

function launchSportConsole(){
 var consoleWindow=window.open("http://news.bbc.co.uk/go/syn/brightview/broadband/sport/-/broadband/sport_console.stm?source=brightview","consoleWindow","width=671,height=405 toolbar=0,location=0,menubar=0,scrollbars=0,status=0");
   consoleWindow.focus();
}

function launchEntertainmentConsole(){
 var consoleWindow=window.open("http://www.bbc.co.uk/go/syn/brightview/broadband/entertainment/-/broadband/entertainment?source=brightview","consoleWindow","width=676,height=510 toolbar=0,location=0,menubar=0,scrollbars=0,status=0");
   consoleWindow.focus();
}

function launchWeatherConsole(){
 var consoleWindow=window.open("http://www.bbc.co.uk/go/syn/brightview/broadband/weather/-/weather/broadband/weather_console.stm?source=brightview","consoleWindow","width=676,height=510 toolbar=0,location=0,menubar=0,scrollbars=0,status=0");
   consoleWindow.focus();
}

function popwin(aPage, aTarget, w, h, var1, var2){
  window.open(aPage,aTarget,'status=no,scrollbars=' +((var1=='scroll' || var2=='scroll')? 'yes' : 'no')+ ',resizable=' +((var1=='resize' || var2=='resize')? 'yes' : 'no')+ ',width='+w+',height='+h);
}

function onSubmitCompForm() {
    var formDOMObj = document.CompForm;
    if (formDOMObj.attach1.value == "")
        alert("Please use the browse button to attach the image to your competition entry.")
    else
        return true;
    return false;
}

function clearField(sForm, sField, sValue){
	if (document.forms[sForm].elements[sField].value == sValue)
		document.forms[sForm].elements[sField].value = ""
	return false;
}
function fillField(sForm, sField, sValue){
	if (document.forms[sForm].elements[sField].value == "")
		document.forms[sForm].elements[sField].value = sValue
	return false;
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

//
//	Sript required for Great Escape Game
//

function setFlashWidth(newW){
	document.getElementById("greatEscapeFlash").style.width = newW+"px";
}
function setFlashHeight(newH){
	document.getElementById("greatEscapeFlash").style.height = newH+"px";		
}
function setFlashSize(newW, newH){
	setFlashWidth(newW);
	setFlashHeight(newH);
}

// Change the display of the ticket rating screen depending on smilie clicked

function rateTheTicket(rating, altrating, Rvalue)
{
	document.getElementById('Toggle-Rating').style.display='block';
	document.getElementById('Toggle-RatingIMG').src='/images/support/rate/'+ rating +'_face.gif';
	document.getElementById('Toggle-RatingIMG').alt=altrating;
	document.formRating.rating_x.value=Rvalue;
}

// Clear the 'Comment on a Ticket' textarea

function clearTextarea (textarea)
{
	if (textarea.innerHTML == 'Please add any extra comments here')
	{
		textarea.innerHTML='';
	}
}

