// CHECK CLIENT BROWSER & PLATFORM
// Works: IE4+, NS4+, Opera

	var its;
	var browserName = '';
	var browserNameLong = '';
	var browserNew = '';
	var preloadFlag = false;
	var Macintosh = navigator.userAgent.indexOf('Mac')>0;

	function its() {
		var n = navigator;
		var ua = ' ' + n.userAgent.toLowerCase();
		var pl = n.platform.toLowerCase();
		var an = n.appName.toLowerCase();

		// browser version
		this.version = n.appVersion;
		this.nn = ua.indexOf('mozilla') > 0;

		// 'compatible' versions of mozilla aren't navigator
		if(ua.indexOf('compatible') > 0) {
			this.nn = false;
		}
		
		this.opera = ua.indexOf('opera') > 0;
		this.ie = ua.indexOf('msie') > 0;
		this.major = parseInt( this.version );
		this.minor = parseFloat( this.version );

		// platform
		this.mac = ua.indexOf('mac') > 0;
		this.win = ua.indexOf('win') > 0;

		// workaround for IE5 which reports itself as version 4.0
		if(this.ie) {
			if(ua.indexOf("msie 5") > 1) {
			var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
			this.major = parseFloat(navigator.appVersion.substr(msieIndex,3));
			}
		}

		return this;
	}

	function browserNaming() {
		its = new its();
		
		// DOM-enabled browser?
		if (!document.getElementById) {
			browserNew = false;
		} else {
			browserNew = true;
		}

		// browser name
		if (its.opera) {
			browserName = "Opera";
		} else if (its.ie) {
			browserName = "IE";
		} else {
			browserName = "NS";
		}

		// browser number
		browserNameLong = browserName + its.major;
	}
	

// PRELOADING THE MOUSEOVER IMAGES
// Works: IE4+, NS4+, Opera

	function createObject(imgName,imgSrc) {
		if (loadingFlag) {
			eval(imgName + ' = new Image()');
			eval(imgName + '.src = "' + imgSrc + '"');
			return imgName;
		}
	}
	
	
// PRELOADS ALL THE BUTTONS NEEDED
// Works: IE4+, NS4+, Opera

	function preButtons() {
		loadingFlag = true;
		
		// footer preloads
        createObject('heartoff','/_img/generic/foot_heart_off.gif');
        createObject('hearton','/_img/generic/foot_heart_on.gif');
        createObject('antioff','/_img/generic/foot_anti_off.gif');
        createObject('antion','/_img/generic/foot_anti_on.gif');
        createObject('catoff','/_img/generic/foot_cat_off.gif');
        createObject('caton','/_img/generic/foot_cat_on.gif');
        
        // button preloads
        createObject('btnmoredoff','/_img/buttons/more_dark_off.gif');
        createObject('btnmoredon','/_img/buttons/more_dark_on.gif');
        createObject('btnmoreloff','/_img/buttons/more_light_off.gif');
        createObject('btnmorelon','/_img/buttons/more_light_on.gif');
        createObject('btnbuycdoff','/_img/buttons/buy_cd_off.gif');
        createObject('btnbuycdon','/_img/buttons/buy_cd_on.gif');
        createObject('btngetmp3off','/_img/buttons/get_mp3_off.gif');
        createObject('btngetmp3on','/_img/buttons/get_mp3_on.gif');
        createObject('btnsubarroff','/_img/buttons/submitarrow_off.gif');
        createObject('btnsubarron','/_img/buttons/submitarrow_on.gif');
        createObject('btngooff','/_img/buttons/go_off.gif');
        createObject('btngoon','/_img/buttons/go_on.gif');
        createObject('btnviewalloff','/_img/buttons/view_all_off.gif');
        createObject('btnviewallon','/_img/buttons/view_all_on.gif');
        createObject('btnnextarroff','/_img/buttons/nextarrow_off.gif');
        createObject('btnnextarron','/_img/buttons/nextarrow_on.gif');
        createObject('btnprevarroff','/_img/buttons/prevarrow_off.gif');
        createObject('btnprevarron','/_img/buttons/prevarrow_on.gif');
        createObject('btnsubmitoff','/_img/buttons/submit_off.gif');
        createObject('btnsubmiton','/_img/buttons/submit_on.gif');
        
        // frontpage preloads
        createObject('tartistsoff','/_img/tabs/artists_off.gif');
        createObject('tartistson','/_img/tabs/artists_on.gif');
        createObject('tartistsover','/_img/tabs/artists_over.gif');
        createObject('tmp3soff','/_img/tabs/mp3s_off.gif');
        createObject('tmp3son','/_img/tabs/mp3s_on.gif');
        createObject('tmp3sover','/_img/tabs/mp3s_over.gif');
        createObject('tvideosoff','/_img/tabs/videos_off.gif');
        createObject('tvideoson','/_img/tabs/videos_on.gif');
        createObject('tvideosover','/_img/tabs/videos_over.gif');
            
        loadingFlag = false;
        preloadFlag = true;
	}


// MOUSEOVER IMAGE SWITCHING
// Works: IE4+, NS4+, Opera
// Notes: NS4 needs the DIV-name in there if image is in a DIV

	function changeImage(layer,imgName,imgObj) {
		if (preloadFlag) {
			if (browserNew) {
				document.getElementById(imgName).src = eval(imgObj+'.src');
			}
			if ((!browserNew) && (browserName == "NS") && (layer!=null)) {
				eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src');
			} else {
				document.images[imgName].src = eval(imgObj+'.src');
			}
		}
	}


// DOM / GET PROPERTY
// Works: IE5+, NS6+, Opera

	function getIdProperty(id,property) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
				if (styleObject[property]) {
					return styleObject[ property ];
				}
			}
		return (styleObject != null) ?
		styleObject[property] :
		null;
	}


// DOM / SET PROPERTY
// Works: IE5+, NS6+, Opera

	function setIdProperty(id,property,value) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
			styleObject[ property ] = value;
		}
	}


// HIDE AND SHOW LAYERS
// Works: IE4+, NS4+, Opera

	function hide(id) {
		if (browserNew) {
			setIdProperty(id,"visibility","hidden");
		} else {
			if (browserName == "NS") { document.layers[id].visibility = "hide"; }
			else { document.all[id].style.visibility = "hidden"; }
		}
	}

	function show(id) {
		if (browserNew) {
			setIdProperty(id,"visibility","visible");
		} else {
			if (browserName == "NS") { document.layers[id].visibility = "show"; }
			else { document.all[id].style.visibility = "visible"; }
		}
	}



// RANDOM NUMBER GENERATOR
// Works: IE4+, NS4+, Opera

	function randNum (num) {
		var now = new Date();
		var rand = Math.round(num * Math.cos(now.getTime()));
		if (rand < 0) rand = - rand; 
		if (rand == 0) rand++;
		return rand;
	}


// ANTI-SPAM
// Works: IE4+, NS6+, Opera

	function antispam(name,domain) {
    	document.location = "mailto:" + name + "@" + domain;
	}


function Swf(swf,w,h,bg,v) {
    this._vars = null;
    this._swf = swf;
    this._w = w;
    this._h = h;
    this._bg = bg;
    this._v = v;
}
Swf.prototype.flashvars = function(str) {
    var uri = top.window.location.href;
    this._vars = str + "&request_uri=" + uri;
}
Swf.prototype.write = function() {
    var out = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
        out += '<embed src="'+this._swf+'" width="'+this._w+'" height="'+this._h+'" bgcolor="'+this._bg+'" wmode="transparent"';
        out += ' flashvars="'+this._vars+'"';
        out += ' quality="high" menu="false" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"';
        out += ' />'
    } else {
        out += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
        out += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this._v+'"';
        out += ' width="'+this._w+'" height="'+this._h+'">';
		out += '<param name="wmode" value="transparent" />';
        out += ' <param name="movie" value="'+this._swf+'" />';
        out += ' <param name="bgcolor" value="'+this._bg+'" />';
        out += ' <param name="flashvars" value="'+this._vars+'" />'
        out += ' <param name="allowScriptAccess" value="sameDomain" />';
        out += ' <param name="quality" value="high" />';
        out += ' <param name="menu" value="false" />';
        out += '</object>';
    }
    document.write(out);
}
