var d = document;

function popWin(URL,ID,WIDTH,HEIGHT,SCROLL) {
    ID = window.open(URL,ID,'width='+WIDTH+',height='+HEIGHT+',resizable=yes,scrollbars='+SCROLL+',menubar=no,toolbar=no,location=no,directories=no,status=no');
	var clientWidth = screen.availWidth;
	var clientHeight = screen.availHeight;
	var xPos = (clientWidth - WIDTH)/2;
	var yPos = (clientHeight - HEIGHT)/2;
	ID.moveTo(xPos,yPos);
}

function parentWin(URL){
	opener.location.href=URL;	
}

function over(imgName, img_src) {
	d[imgName].src=img_src;
}

function out(imgName, img_src) {
	d[imgName].src=img_src;
}

function preLoadMyImages() {
	arg=preLoadMyImages.arguments;
	imgs=new Array();
	i=imgs.length
	for(i=0; i<arg.length; i++)
	if (arg[i]!=0) {
		imgs[i]=new Image;
		imgs[i].src=location.host + arg[i];
	}
}

function changeImg(imgSrc) {
	d.main.src=imgSrc;
}

var rand = Math.ceil(Math.random() * 4);
var bg;

var bg1 = "bia_sub_photo_bugs.jpg";
var bg2 = "bia_sub_about_daffy.jpg";
var bg3 = "bia_sub_poster_taz.jpg";

if(rand == 2){
	bg = bg2;
}else if(rand == 3){
	bg = bg3;
}else{
	bg = bg1;
}

var n = navigator;
var agent = n.userAgent.toLowerCase();
var name = n.appName.toLowerCase();
var opera = agent.indexOf("opera") != -1;
var speed = 20;

var sniff = {
	bw: {
		ie:agent.indexOf("msie") != -1 && !opera,
		ie4:agent.indexOf("msie 4.") != -1 && !opera,
		ie5:agent.indexOf("msie 5.") != -1 && !opera,
		ie6:agent.indexOf("msie 6.") != -1 && !opera,
		ns:name.indexOf("netscape") != -1 && agent.indexOf("gecko") == -1,
		ns6:agent.indexOf("netscape") != -1 && agent.indexOf("gecko") != -1
	},
	os: {
		win:n.userAgent.indexOf("Win") != -1,
		mac:n.userAgent.indexOf("Mac") != -1
	}
};

var distance = (sniff.os.mac && sniff.bw.ns6 || sniff.os.win && sniff.bw.ie4)?5:(sniff.os.mac && sniff.bw.ns)?6:4;

function ScrollerObj(lyr1, lyr2) {
	this.container = {
		obj:(sniff.bw.ns)?d[lyr1]:sniff.bw.ie?d.all[lyr1]:d.getElementById(lyr1),
		css:(sniff.bw.ns)?d[lyr1]:sniff.bw.ie?d.all[lyr1].style:d.getElementById(lyr1).style,
		height:(sniff.bw.ns)?d[lyr1].clip.height:sniff.bw.ie?d.all[lyr1].offsetHeight:d.getElementById(lyr1).offsetHeight
	};
	this.content = {
		obj:(sniff.bw.ns)?d[lyr1].document[lyr2]:sniff.bw.ie?d.all[lyr2]:d.getElementById(lyr2),
		css:(sniff.bw.ns)?d[lyr1].document[lyr2]:sniff.bw.ie?d.all[lyr2].style:d.getElementById(lyr2).style,
		height:(sniff.bw.ns)?d[lyr1].document[lyr2].clip.height:sniff.bw.ie?d.all[lyr2].offsetHeight:d.getElementById(lyr2).offsetHeight
	};
	this.prop = {
		dif:this.container.height - this.content.height
	};
	this.obj = lyr2 + "Object"; eval(this.obj + "=this");
	return this;
}

ScrollerObj.prototype.top = 0;
ScrollerObj.prototype.tid = null;

ScrollerObj.prototype.move = function(x, y) {
	this.content.css.left = x;
	this.content.css.top = y;
}

ScrollerObj.prototype.scrollDown = function() {
	if (this.container.height < (this.content.height + this.top)) {
		this.move(0, (parseInt(this.top) - distance));
		if (parseInt(this.top) >= parseInt(this.prop.dif)) {
			this.tid = setTimeout(this.obj + ".scrollDown()", speed);
		}
		this.top = parseInt(this.top) - distance;
	} else {
		this.stopScroll();
	}
}

ScrollerObj.prototype.scrollUp = function() {
	if(parseInt(this.top) != 0) {
		this.move(0, (parseInt(this.top) + distance));
		this.top = parseInt(this.top) +distance;
		this.tid = setTimeout(this.obj + ".scrollUp()", speed);
	}
}

ScrollerObj.prototype.stopScroll = function() {
	clearTimeout(this.tid);
}

function createObj() {
	scroller1 = new ScrollerObj('divContainer', 'divContent');
}

function land(ref, target)

{

lowtarget=target.toLowerCase();

if (lowtarget=="_self") {window.location=loc;}

else {if (lowtarget=="_top") {top.location=loc;}

else {if (lowtarget=="_blank") {window.open(loc);}

else {if (lowtarget=="_parent") {parent.location=loc;}

else {parent.frames[target].location=loc;};

}}}

}

function jump(menu)

{

ref=menu.choice.options[menu.choice.selectedIndex].value;

splitc=ref.lastIndexOf("*");

target="";

if (splitc!=-1)

{loc=ref.substring(0,splitc);

target=ref.substring(splitc+1,1000);}

else {loc=ref; target="_blank";};

if (ref != "") {land(loc,target);}

}

function funstuffBookmark()
{
var url = "http://www2.warnerbros.com/web/main/fun_stuff/funstuff.jsp";
var title = "Warner Bros. Online: Fun Stuff!";

if(document.all)
window.external.AddFavorite(url,title)
}

function funstuffBookmark()
{
var url = "http://www2.warnerbros.com/web/main/fun_stuff/funstuff.jsp";
var title = "Warner Bros. Online: Fun Stuff!";
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_ie = (agt.indexOf("msie") != -1);
var is_ie4up = (is_ie && (is_major >= 4));
var is_pc=(navigator.platform.substring(0,3)=='Win');

if	(document.all&&is_ie4up&&is_pc)
	window.external.AddFavorite(url,title);
	else 
	alert ("We're sorry, this function is not available with your browser.  Please bookmark this page by using your normal bookmarking methods.");
}

function winBookmark()
{
var url = "http://www2.warnerbros.com/web/main/funstuff/funstuff_win.jsp";
var title = "Warner Bros. Online: Win!";
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_ie = (agt.indexOf("msie") != -1);
var is_ie4up = (is_ie && (is_major >= 4));
var is_pc=(navigator.platform.substring(0,3)=='Win');

if	(document.all&&is_ie4up&&is_pc)
	window.external.AddFavorite(url,title);
	else 
	alert ("We're sorry, this function is not available with your browser.  Please bookmark this page by using your normal bookmarking methods.");
}

function downloadsBookmark()
{
var url = "http://www2.warnerbros.com/web/main/funstuff/funstuff_downloads.jsp";
var title = "Warner Bros. Online: Digital Downloads";
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_ie = (agt.indexOf("msie") != -1);
var is_ie4up = (is_ie && (is_major >= 4));
var is_pc=(navigator.platform.substring(0,3)=='Win');

if	(document.all&&is_ie4up&&is_pc)
	window.external.AddFavorite(url,title);
	else 
	alert ("We're sorry, this function is not available with your browser.  Please bookmark this page by using your normal bookmarking methods.");
}

function homepageBookmark()
{
var url = "http://www.warnerbros.co.jp/main/homepage/homepage.html";
var title = "Warner Bros. Online";
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_ie = (agt.indexOf("msie") != -1);
var is_ie4up = (is_ie && (is_major >= 4));
var is_pc=(navigator.platform.substring(0,3)=='Win');

if	(document.all&&is_ie4up&&is_pc)
	window.external.AddFavorite(url,title);
	else 
	alert ("We're sorry, this function is not available with your browser.  Please bookmark this page by using your normal bookmarking methods.");
}

function latinoBookmark()
{
var url = "http://www2.warnerbros.com/main/latino/latino.html";
var title = "Warner Bros. Online Latino";
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_ie = (agt.indexOf("msie") != -1);
var is_ie4up = (is_ie && (is_major >= 4));
var is_pc=(navigator.platform.substring(0,3)=='Win');

if	(document.all&&is_ie4up&&is_pc)
	window.external.AddFavorite(url,title);
	else 
	alert ("We're sorry, this function is not available with your browser.  Please bookmark this page by using your normal bookmarking methods.");
}

//URL QuerySting Processor
function queryStringValidator(url,userDefKey) {

var questionMark = url.indexOf("?");
var redirectJSP = url.indexOf("/web/main/redirect/redirect.jsp");

if (redirectJSP >= 0){
	url = url + "%26frompromo%3D" + userDefKey;
}
else if (questionMark >= 0){
	url = url + "&frompromo=" + userDefKey;
}
else {	
	url = url + "?frompromo=" + userDefKey;
}
location = url;
}