
/* -------------------------------------------------- Property of JanesBomb.com -------------------------------------------------- */

	var isNav          = (navigator.appName.indexOf("Netscape") > -1);
	var isIE           = (navigator.appName.indexOf("Explorer") > -1);
	var isSafari       = (navigator.appVersion.indexOf("Safari") > -1);

	var begin           = isIE ? (navigator.appVersion.indexOf("MSIE")+5) : 0;
	var end             = navigator.appVersion.indexOf('.',begin);
	var appVersionMajor = new Number(navigator.appVersion.substring(begin,(end>-1) ? end : navigator.appVersion.length()-1));

	var isNav4OrBetter = isNav && (appVersionMajor >= 4);
	var isNav5OrBetter = isNav && (appVersionMajor >= 5);
	var isNav6OrBetter = isNav && (appVersionMajor >= 6);

	var badNS 		   = isNav && (appVersionMajor <= 7);

	var isIE4OrBetter  = isIE && (appVersionMajor >= 4);
	var isIE5OrBetter  = isIE && (appVersionMajor >= 5);
	var isIE6OrBetter  = isIE && (appVersionMajor >= 6);

	var isWindows = (navigator.platform.indexOf("Win") >= 0);
	var isUnix    = (navigator.platform.indexOf("nix") >= 0);
	var isMac     = (navigator.platform.indexOf("Mac") >= 0);

function openBigger(p) {

	var biggerWin = window.open("","","toolbar=no,location=no,status=no,toolbar=no,menubar=no,scrollbars=no,resizeable=no,dependent=no,width=100,height=100")
		
	biggerWin.document.open("text/html","replace")
	biggerWin.document.write("<HTML><TITLE>Majestic Vanguard</TITLE><BODY onLoad='window.resizeTo(document.images[0].width,document.images[0].height+70);window.moveTo((screen.availWidth / 2) - (document.images[0].width / 2),(screen.availHeight / 2) - (document.images[0].height / 2))' leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><A HREF='#' onClick='window.close()'><IMG SRC=" + p + " BORDER=0></BODY></HTML>")
	biggerWin.document.close()
					
	biggerWin.focus()
}

	function niceButton(text,onClick,framedoc) {

		/* Print button... use ordinary button if using a bad NS */

		if (typeof onClick == "undefined")
			onClick = "";

		if ( !framedoc )
			framedoc = document;

		if ( !badNS ) {
			framedoc.writeln("				<TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' CLASS='niceButton'><TR><TD>")
			// I had to put [onClick] in both event and HREF to get it work in all browsers...
			framedoc.write("					<A HREF='#' onClick='" + onClick + "' CLASS='niceButton'>")
			framedoc.write(							text)
			framedoc.writeln("					</A>")
			framedoc.writeln("				</TD></TR></TABLE>")
		} else {
			framedoc.writeln("				<FORM><INPUT TYPE=button VALUE='" + text + "' onClick='" + onClick + "'></FORM>")
		}
	}

	function skrivGastbok(form) {

		var Name = form.name;
		var Email = form.email;
		var Captcha = form.captcha_code;
		var Url = form.url;
		var Comment = form.comment;

		// Check Name
		if ( !Name.value ) {
			alert("Write your name!")
			Name.focus();
			return false;
		}

		// Check Comment
		if ( !Comment.value ) {
			alert("You have to write a comment!")
			Comment.focus();
			return false;
		}

		// Check Captcha
		if ( !Captcha.value ) {
			alert("You have to enter the code!")
			Captcha.focus();
			return false;
		}

		form.submit();
	}

	function getFile(file) {

		var fileWin = window.open(file,"","width=200,height=100")
	}

	function getMp3Image(file) {

		var mp3ImgName = file.substr(file.lastIndexOf("/")+1) + ".gif";
			mp3ImgName = mp3ImgName.substr(0,mp3ImgName.lastIndexOf(".mp3")) + ".gif";
			
		return( mp3ImgName );
	}

	function resizeMp3Win(win,imgWidth,imgHeight) {

		var winWidth 	= imgWidth + 50;
		var winHeight 	= imgHeight + 138;

		var leftPos 	= ( screen.availWidth / 2 ) - ( winWidth / 2 )
		var topPos 		= ( screen.availHeight / 2 ) - ( winHeight / 2 )

		win.resizeTo(winWidth,winHeight)
		win.moveTo(leftPos,topPos)
		
	}

	function Mp3(file) {

		var mp3Win = window.open("","mp3Win","toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=yes,width=260,height=300")

		mp3Win.document.open()
		mp3Win.document.write("<HTML>")
		mp3Win.document.write("<BODY BGCOLOR=black onLoad='opener.resizeMp3Win(window,document.images[0].width,document.images[0].height)' LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>")

		mp3Win.document.write("<CENTER><BR><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2><TR><TD ALIGN=center STYLE='border:solid white 1px;'>")

		var mp3Img = getMp3Image(file);

		if ( mp3Img )
			mp3Win.document.write("<IMG SRC='../img/" + mp3Img + "' BORDER=0><BR>")
		
		mp3Win.document.write("<embed src='" + file + "' width='100%' height='50' kioskmode='true' pluginspage='http://www.apple.com/quicktime/products/qt/' name='Janes Bomb' autostart='true'>")

		mp3Win.document.write("</TD></TR></TABLE></CENTER>")

		mp3Win.document.write("</BODY>")
		mp3Win.document.write("</HTML>")
		mp3Win.document.close()
	}
