/* 
This file is Copyright (c) 2001 Jason Brown/The Attik. All rights of the author(s) reserved
you may not re-use, distribute or alter this file without written authorisation
*/

var rStr = '/default.asp?url=';
if(screen.width<800)	{
	top.location.href = rStr + '/lowScreenRes.asp';
}

if(self==top)	{
	top.location.href = rStr + self.location.pathname + self.location.search;
}

function jumpTo(c)	{
	var l = c.options[c.selectedIndex].value; (l!=''&&l!='undefined')?self.location.href=l:null;
}

function showHide(d, tp)	{
	if(document.all)	{
		var l = document.all[d].style; l.visibility = tp;
	}	else if(document.layers)	{
		var l = document.layers[d];	l.visibility = tp=='visible'?'show':'hide';
	}	else	{
		var l = document.getElementById(d).style; l.visibility = tp;
	}	
}

var to; // timeout handle

function scrollLayer(d, x, y)	{ // Copyright (c) Jason Brown/The Attik Sydney 2001 All Rights reserved
	var topLimit = (arguments[3])?arguments[3]:-150; var bottomLimit = (arguments[4])?arguments[4]:200;
	if(parseInt(navigator.appVersion)>=4)	{ var clipArray;
		if(document.all)	{	// IE
			//if(parseInt(l.style.top)<topLimit||parseInt(l.style.top)>bottomLimit) { return; }
			var l = document.all[d];
			clipArray = parseClips(l.style.clip);
			l.style.top = (parseInt(l.style.top) + y) + 'px';
			l.style.left = (parseInt(l.style.left) + x) + 'px';
			clipArray[0] = (parseInt(clipArray[0]) - y);
			clipArray[1] = (parseInt(clipArray[1]) - x);
			clipArray[2] = (parseInt(clipArray[2]) - y);
			clipArray[3] = (parseInt(clipArray[3]) - x);
			pars = 'rect(' + clipArray[0] + 'px ' + clipArray[1] + 'px ' + clipArray[2] + 'px ' + clipArray[3] + 'px)';
			l.style.clip = pars; 
		}	else if(document.layers)	{	// NN4 - joy
			//if(parseInt(l.top)<=topLimit||parseInt(l.top)>=bottomLimit) { return; }
			var l = document.layers[d]; l.top += y; l.left += x; l.clip.top -= y;
			l.clip.right -= x; l.clip.bottom -= y; l.clip.left -= x;
		}	else	{ //NN6/Opera
			//if(parseInt(l.style.top)<topLimit||parseInt(l.style.top)>bottomLimit) { return; }
			var l = document.getElementById(d);
			l.style.top = (parseInt(l.style.top) + y) + 'px';
			l.style.left = (parseInt(l.style.left) + x) + 'px';
			clipArray = parseClips(l.style.clip);
			clipArray[0] = (parseInt(clipArray[0]) - y);
			clipArray[1] = (parseInt(clipArray[1]) - x);
			clipArray[2] = (parseInt(clipArray[2]) - y);
			clipArray[3] = (parseInt(clipArray[3]) - x);
			pars = 'rect(' + clipArray[0] + 'px ' + clipArray[1] + 'px ' + clipArray[2] + 'px ' + clipArray[3] + 'px)';
			l.style.clip = pars;
		}	//to = setTimeout('scrollLayer("'+d+'", '+x+', '+y+', '+topLimit+', '+bottomLimit+')', 150);
	}
}

function parseClips(clip)	{
	var arr = clip.split("rect(")[1].split(")")[0].split("px");	return arr;
}

function r(i, s)	{ // worlds smallest image swap script
	var d = document.images; d?d[i].src=s:null;
}

function preQTVR(n)	{
	for(var x=1;x<=n;x++)	{
		eval('i'+x + ' = new Image()'); eval('i'+x).src = '/img/layouts/qtvr/qtvr_0'+x+'.gif';
	}
}

function qr(i, s)	{
	var d = document.images; d?d[i].src='/img/layouts/quickfind/'+s+'.gif':null;
}

function preQuickFind()	{
	var ims = new Array('about_on.gif', 'awards_on.gif','contact_on.gif', 'credit_on.gif','dart_on.gif','dolby_on.gif','equip_on.gif', 'fairlight_on.gif','inflight_on.gif','isdn_on.gif','news_on.gif','qtvr_on.gif', 'r01_on.gif', 'r02_on.gif', 'r03_on.gif','r04_on.gif', 'r05_on.gif', 'r06_on.gif', 'r07_on.gif','r08_on.gif','rate_on.gif','rhits_on.gif',' services_on.gif', 'sound_on.gif', 'studios_on.gif', 'team_on.gif', 'tvradio_on.gif', 'vr02_on.gif', 'vr03_on.gif','vr04_on.gif','vr05_on.gif','vr01_on.gif');
	for(var x =0;x<ims.length;x++)	{
		eval("ims" + x + ' = new Image();'); eval('ims'+x).src = '/img/layouts/quickfind/'+ims[x];
	}
}

function isValidApp(frm)	{	
	var boolValid = true; var strMsg = 'The following Error(s) occurred\n\n';
	if(!frm.elements['agreetoterms'].checked)	{
		boolValid = false; strMsg += '- You must agree to the terms and conditions\n';
	}	
	for(var x=0;x<frm.length;x++)	{
		if(frm.elements[x].type!='checkbox'&&frm.elements[x].value=='')	{
			boolValid = false; strMsg += '- All fields are mandatory. you may not leave ' + frm.elements[x].name + ' blank\n';			
		}
	}
	if(boolValid == false)	{
		alert(strMsg); return false;
	}	return boolValid;
}

function doCookie(a)	{
	//alert('parsed Sound cookie = ' + parseCookies("sound"))
	var a = (parseCookies("sound")=='no'?'yes':'no'); //alert('current cookie = ' + a);
	var i = '/img/sound_' + (a=='yes'?'on':'off') + '.gif';
	//document.images['soundSwitch'].src = i;
	document.cookie = ("sound=" + a + ";path=/");
	top.frames[1].location.reload(); self.location.reload();
	
}

function parseCookies()	{
			if(arguments.length>1) return 'error : only one argument may be used';
			var resArray = new Array();	var qs = document.cookie; 
			var raw = new String(qs); var keys = raw.split(/,|;/);
			if(arguments.length>0)	{ var txt = trim(arguments[0].toString());
			var txtLen = txt.length; var y = 0;
				for(var x=0;x<keys.length;x++)	{ 
					if(trim(keys[x].substring(0,txtLen+1).toString()) == txt)	{
						resArray[y] = keys[x].substring(txtLen+2,keys[x].length); y++;
					}
				} if(resArray.length>0) 
					return resArray.toString();
				else return '';
			}		else	{
				return keys
			}	}
			
function trim(txt) { // trim leading and trailing spaces
    while (txt.substring(0,1) == ' ') {
        txt = txt.substring(1, txt.length);
	}
    while (txt.substring(txt.length-1,txt.length) == ' ') {
        txt = txt.substring(0, txt.length-1);
	}	return txt;
} 