
// *** INITIALIZE ***

var isIE = false;
var isNS4 = false;
var isNS6 = false;
var mainBorder;



BrowserCheck();



function Initialize() {
	
	var myBody = document.getElementById('myBody');
	//alert(myBody);
	if ((getCookie("joekaweb_bgimage") != null) && (getCookie("joekaweb_bgcolour") != null)) 
	{
	    myBody.style.backgroundImage = unescape(getCookie("joekaweb_bgimage"));
	    myBody.style.backgroundColor = unescape(getCookie("joekaweb_bgcolour"));
	}
}




function showLogin() {

	var firstLogin = document.getElementById('spanLogin1');
	var secondLogin = document.getElementById('spanLogin2');
		
	if (firstLogin.style.display == 'inline') {
		firstLogin.style.display = 'none';
		secondLogin.style.display = 'inline';
		document.getElementById('txtLogin').focus();
	} else {
		firstLogin.style.display = 'inline';
		secondLogin.style.display = 'none';
	}
}




// *** POPUP WINDOWS ***

var aWin = null;
    var winPosX = 0;
    var winPosY = 0;
    	
    function getScreenCenter(theWidth, theHeight) { // Get ScreenCenter
	    winPosX = (screen.width/2) - (theWidth/2);
	    winPosY = (screen.height/2) - (theHeight/2);
	    //if (newWin) newWin.close();
	    //if (theWidth == 0) theWidth = 300;
	    //if (theHeight == 0) theHeight = 200;
    }
    function showSubPage(pageurl, theWidth, theHeight) { // Sub Page Pop Up...
	    if (newWin) newWin.close();
	    getScreenCenter(theWidth, theHeight);
	    newWin = window.open('','newWin','scrollbars=no,resizable=no,width='+(theWidth)+',height='+(theHeight)+',status=no,location=no,left='+winPosX+',top='+winPosY+',menubar=no');
	    newWin.window.location.href = pageurl;
	    newWin.focus();
    }
    

// dont think this function is used?.. feb07
function showPopUp(pageurl, theWidth, theHeight) {
	
	if (aWin) aWin.close();
	aWin = window.open(pageurl,'newWin','scrollbars=no,resizable=no,width='+theWidth+',height='+theHeight+',status=no,location=no,left=20,top=20,menubar=no');
	aWin.focus();
}

// MP3Player Window

var newWin = null;
function showMP3Player(theTune) {
	if (newWin) newWin.close();
		newWin = window.open('mp3player.aspx?tune='+escape(theTune),'newWin','scrollbars=no,resizable=no,width=249,height=120,status=no,location=no,left=20,top=20,menubar=no');
		newWin.focus();
	}

// RecordPlayer Window
	
function showRecordPlayer(theTune) {
	if (newWin) newWin.close();
		newWin = window.open('recordplayer.aspx?tune='+escape(theTune),'newWin','scrollbars=no,resizable=no,width=200,height=185,status=no,location=no,left=20,top=20,menubar=no');
		newWin.focus();
	}




// *** ROLLOVERS ***

var imgHome;
var imgPortfolio;
var imgMoreStuff;
var imgContact;
var imgLogin;
var imgPhotos;
var img4Squares;

img4Squares = new Image();
img4Squares.src = 'images/menu/4squares_over.gif';

imgHome = new Image();
imgHome.src = 'images/menu/home_over.gif';

imgPortfolio = new Image();
imgPortfolio.src = 'images/menu/portfolio_over.gif';

imgMoreStuff = new Image();
imgMoreStuff.src = 'images/menu/morestuff_over.gif';

imgContact = new Image();
imgContact.src = 'images/menu/contact_over.gif';

imgPhotos = new Image();
imgPhotos.src = 'images/menu/photos_over.gif';

imgLogin = new Image();
imgLogin.src = 'images/menu/login_over.gif';





// *** HEIGHT ADJUSTMENTS ***

function BrowserCheck() {
	if (document.all) { 
		isIE = true;
	} else if (document.layers) {
		isNS4 = true;
	} else if (document.getElementById) {
		isNS6 = true;
	}
}


// *** COLOUR CHANGER ***

function ChangeColour() {

var strImage;
var strColour;
var myBody = document.getElementById("myBody");
	//alert(myBody.style.backgroundImage);
		
	switch(myBody.style.backgroundImage)
	{
		case "": {
			strImage = "url(images/background_repeat_red.gif)";
            strColour = "#c19898";
			break;
		}
		case "url(images/background_repeat.gif)": {
			strImage = "url(images/background_repeat_red.gif)";
            strColour = "#c19898";
			break;
		}
		case "url(images/background_repeat_red.gif)": {
			strImage = "url(images/background_repeat_yellow.gif)";
            strColour = "#c1c198";
			break;
		}
		case "url(images/background_repeat_yellow.gif)": {
			strImage = "url(images/background_repeat_green.gif)";
            strColour = "#98c198";
			break;
		}
		case "url(images/background_repeat_green.gif)": {
			strImage = "url(images/background_repeat_lightblue.gif)";
            strColour = "#98c1c1";
			break;
		}
		case "url(images/background_repeat_lightblue.gif)": {
			strImage = "url(images/background_repeat_darkblue.gif)";
            strColour = "#9898c1";
			break;
		}
		case "url(images/background_repeat_darkblue.gif)": {
			strImage = "url(images/background_repeat_purple.gif)";
            strColour = "#c198c1";
			break;
		}
		case "url(images/background_repeat_purple.gif)": {
			strImage = "url(images/background_repeat.gif)";
            strColour = "#AEAAAA";
			break;
		}
		
		default: {
			strImage = "url(images/background_repeat.gif)";
            strColour = "#AEAAAA";
			break;
		}
	}

	setCookie("joekaweb_bgimage", strImage, 31);
	setCookie("joekaweb_bgcolour", strColour, 31);
	//alert(strImage);
	myBody.style.backgroundImage = strImage;
	myBody.style.backgroundColor = strColour;
	
}






// Show \ Hide Adverts
function showAdverts() {
	var isIE = false;
	if (document.all) { 
		isIE = true;
	} else if (document.layers) {
		isNS4 = true;
	} else if (document.getElementById) {
		isNS6 = true;
	}
		
	theWidth = 0;
	if (isIE) {
		theWidth = document.documentElement.clientWidth;
	} else {
		theWidth = window.innerWidth;
	}
	
	//Typical width of 1024x768 window is: 1005
	
	if (theWidth < 1030) {
		//document.getElementById('ads_left').style.visibility = "hidden";
		
		if (document.getElementById('ctl00_ads_right') != null)
		    document.getElementById('ctl00_ads_right').style.visibility = "hidden";
		else if (document.getElementById('ctl00_ads_right_exahost') != null)
		    document.getElementById('ctl00_ads_right_exahost').style.visibility = "hidden";
	} else {
		//document.getElementById('ads_left').style.visibility = "visible";
		
		if (document.getElementById('ctl00_ads_right') != null)
		    document.getElementById('ctl00_ads_right').style.visibility = "visible";
		else if (document.getElementById('ctl00_ads_right_exahost') != null)
		    document.getElementById('ctl00_ads_right_exahost').style.visibility = "visible";
	}
}


// Function for fixing the "Activate this control.." message for flash objects..

function ShowFlash(DIV_ID, flashurl, width, height)
{
    var d = document.getElementById(DIV_ID); 
    d.innerHTML = WriteFlash(DIV_ID, flashurl, width, height); 
}

function WriteFlash(DIV_ID, flashurl, width, height)
{
    var j = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"';
    j += 'width="' + width + '" height="' + height + '" id="' + DIV_ID + '_flash" align="middle">';
    j += '<param name="allowScriptAccess" value="sameDomain" />';
    j += '<param name="movie" value="' + flashurl + '" />';
    j += '<param name="quality" value="high" />';
    j += '<param name="menu" value="false" />';
    j += '<param name="bgcolor" value="#ffffff" />';
    j += '<embed src="' + flashurl + '" quality="high" bgcolor="#ffffff" ';
    j += 'width="' + width + '" height="' + height + '" name="' + DIV_ID + '_flash" menu="false" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
    j += '</object>';
    //alert(j);
    return j;
}