function BrowserCheck() {
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	this.version = navigator.appVersion;
	this.v = parseInt(this.version);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0);
	this.ie5 = (this.version.indexOf('MSIE 5')>0);
	this.min = (this.ns||this.ie);
	this.pc = (this.version.indexOf('Win')>0);
	this.mac = (this.version.indexOf('PPC')>0);
	this.ns408=(parseFloat(this.version)==4.08);
}

var is = new BrowserCheck();

if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
	widthCheck = window.innerWidth;
	heightCheck = window.innerHeight;
	window.onResize = resizeFix;
}



var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the FSCommand messages in a Flash movie.
function MoonviewSplash_DoFSCommand(command, args) {
	var MoonviewSplashObj = isInternetExplorer ? document.all.MoonviewSplash : document.MoonviewSplash;
	//
	// Place your code here.
	//
}

function hide ( name ) {
	NS4 = (document.layers) ? 1 : 0;
	IE4 = (document.all) ? 1 : 0;
	W3C = (document.getElementById) ? 1 : 0;        
	if (W3C) {
		document.getElementById(name).style.display = "none";
	} else if (NS4) {
		document.layers[name].visibility = "none";
	} else {
		document.all[name].style.display = "none";
	}
}
function show (name ) {
	var ele;                //points to the popup element

	NS4 = (document.layers) ? 1 : 0;
	IE4 = (document.all) ? 1 : 0;
	W3C = (document.getElementById) ? 1 : 0;

	if ( W3C ) {
		ele = document.getElementById(name);
	} else if ( NS4 ) {
		ele = document.layers[name];
	} else {        // meant for IE4
		ele = window.opener.document.all[name];
	}

	if ( NS4 ) {
		ele.visibility.display = "block";
	} else {  // IE4 & W3C
		ele.style.display = "block";
	}
}


// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub MoonviewSplash_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call MoonviewSplash_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

function translateQueryString() {
	var sQS	= unescape(location.search).substr(1);
	var oQS	= {};
	if (sQS.length) {
		var aQS_items	= sQS.split('&'), nQS_items = aQS_items.length, nQS_itemsIdx, aQS_keyValue, nQS_keyValue, nQS_keyValueIdx;
		for (nQS_itemsIdx = 0; nQS_itemsIdx < nQS_items; nQS_itemsIdx++) {
			aQS_keyValue	= aQS_items[nQS_itemsIdx].split('='), nQS_keyValue = aQS_keyValue.length;
			for (nQS_keyValueIdx = 0; nQS_keyValueIdx < nQS_keyValue; nQS_keyValueIdx++) oQS[aQS_keyValue[0]] = aQS_keyValue[1];
		}
	}
	return oQS;
}
var QueryString	= translateQueryString();




function openWallpaper(id) {
	var paraString;
	var wt;
	var ht;
	var width = screen.width;
	var height = screen.height;
	var winWidth;
	var winHeight;
	var curLeft;
	var curTop;

	wt = 800;
	ht = 600;

	if (navigator.appName == "Netscape") {
		curLeft = self.screenX;
		curTop = self.screenY;
	  	winWidth = window.innerWidth;
		winHeight = window.innerHeight;
	}
	else {
		curLeft = self.screenLeft;
		curTop = self.screenTop;
		winWidth = document.documentElement.offsetWidth;
		winHeight = document.documentElement.offsetHeight;
	}

	var winl;
	var wint;

	if (wt > winWidth) {
			winl = (screen.width - wt) / 2;
	}
	else {
		winl = curLeft + ((winWidth - wt) / 2);
	}

	if (ht > winHeight) {
			var wint = (screen.height - ht) / 2;
	}
	else {
		wint = curTop + ((winHeight - ht) / 2);
	}

	if (is.pc){wint = wint - 25};
	paraString = "width=" + wt + ",height=" + ht + ",top=" + wint + ",left=" + winl;
	paraString = paraString + ",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1";

	poppedWindow = window.open("/wallpaperview.html?id=" + id + "&size=800","wallpapers",paraString);
	poppedWindow.focus();
}
