agt = navigator.userAgent.toLowerCase();
app = navigator.appName.toLowerCase();

///// OS
osCode = "";
osVersion = "";
osName = "";

if (agt.indexOf( "win") != -1) {
	osCode = "win";
	osName = "Windows";
  	if (agt.indexOf( "nt 5.1") != -1) {
		osVersion = "XP";
  	} else if (agt.indexOf( "nt 5.0") != -1) {
		osVersion = "2000";
  	} else if (( agt.indexOf( "nt 4.0") != -1) || ( agt.indexOf( "nt;") != -1) || ( agt.indexOf( "winnt4") != -1) || ( agt.indexOf( "windows nt") != -1)) {
		osVersion = "NT";
  	} else if (agt.indexOf( "98") != -1) {
		osVersion = "98";
  	} else if (agt.indexOf( "windows 95") != -1) {
		osVersion = "95";
  	}
} else if (agt.indexOf( "mac") != -1) {
	osCode = "mac";
	osName = "MacOS";
	if (agt.indexOf( "mac os x") != -1) {
		osVersion = "X";
	}
} else if (agt.indexOf( "linux") != -1) {
	osCode = "linux";
	osName = "Linux";
} else {
	osCode = "win";
	osName = "Windows";
}

///// NAV
navCode = "";
navVersion = "";
navName = "";

if (agt.indexOf( "msie") != -1) {
	navCode = "ie";
	navName = "Internet Explorer";
	navVersion = agt.substr( agt.indexOf( "msie") + 5, 1);
} else if (agt.indexOf( "safari") != -1) {
	navCode = "safari";
	navName = "Safari";
	navVersion = "1";
} else if (agt.indexOf( "netscape") != -1 || ( app.indexOf( "netscape") != -1 && app.indexOf( "safari") == -1)) {
	navCode = "ns";
	navName = "Netscape";
	if (agt.indexOf( "netscape/7") != -1) {
		navVersion = "7";
	} else if (agt.indexOf( "netscape6/6") != -1) {
		navVersion = "6";
	} else if (agt.indexOf( "mozilla/4") != -1) {
		navVersion = "4";
	} else {
		navCode = "mozilla";
		navName = "Mozilla";
		navVersion = agt.substr( agt.indexOf( "rv:") + 3, 3);
	}
} else if (agt.indexOf( "firebird") != -1) {
	navCode = "firebird";
	navName = "Mozilla Firebird";
	navVersion = agt.substr( agt.indexOf( "firebird/") + 9, 3);
} else if (agt.indexOf( "firefox") != -1) {
	navCode = "firefox";
	navName = "Mozilla Firefox";
	navVersion = agt.substr( agt.indexOf( "firefox/") + 8, 3);
} else if (agt.indexOf( "konqueror") != -1) {
	navCode = "konqueror";
	navName = "Konqueror";
}

///// WINDOW
bodyWidth = screen.availWidth;
bodyHeight = screen.availHeight;
screenWidth = screen.width;
screenHeight = screen.height;

function windowOpen( title, url, x, y, width, height, location, menubar, toolbar, scrollbars, status, resizable, fullscreen) {
	var tmpWindow = window.open( url, title, "left=" + x + ",top=" + y + ",width=" + width + ",height=" + height + ",location=" + location + ",menubar=" + menubar + ",toolbar=" + toolbar + ",scrollbars=" + scrollbars + ",status=" + status + ",resizable=" + resizable + ",fullscreen=" + fullscreen);
tmpWindow.focus();
	return( tmpWindow);
}

function popupOpen( title, url, width, height, scrollbars) {
	var tmpWindow = windowOpen( title, url, ( screenWidth - width) / 2 - 5, ( screenHeight - height) / 2 - 20, width, height, 'no', 'no', 'no', scrollbars, 'no', 'no', 'no');
}

function popupOpenFullScreen( title, url, fullscreen) {
	var tmpWidth = bodyWidth;
	var tmpHeight = bodyHeight;
	if (navCode == "ns" && osCode == "mac") {
		tmpWidth -= 10;
		tmpHeight -= 25;
	}
	var tmpWindow = windowOpen( title, url, 0, 0, tmpWidth, tmpHeight, 'no', 'no', 'no', 'no', 'no', 'no', fullscreen);
	tmpWindow.resizeTo( tmpWidth, tmpHeight);
}
popupOpenFullScreen = popupOpenFullScreen;

function includeFlash(version, id, width, height, align, allowScriptAccess, movie, loop, menu, quality, scale, bgcolor, salign, flashvars, noembed, wmode, swLiveConnect) {
	if ( version == "") version = "";
	if ( id == "") id  = "movie";
	if ( width == "") width = "980";
	if ( height == "") height = "560";
	if ( align == "") align = "middle";
	if ( allowScriptAccess == "") allowScriptAccess = "sameDomain";
	if ( movie == "") movie = "movie.swf";
	if ( movie.indexOf("?") != -1) {
		movie += "&MMPlayerType=";
	} else{
		movie += "?MMPlayerType=";
	}
	if ( loop == "") loop = "false";
	if ( menu == "") menu = "false";
	if ( quality == "") quality = "best";
	if ( scale == "") scale = "noscale";
	if ( bgcolor == "") bgcolor = "#FFFFFF";
	if ( salign == "") salign = "TL";
	if ( flashvars == "") flashvars = "";
	if ( noembed == "") noembed = "";
	if ( wmode == "") wmode = "window";
	if ( swLiveConnect == "") swLiveConnect = "false";
	var htmlCode_str = "";
	htmlCode_str += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab';
	if (version != "") {
		htmlCode_str += '#version=' + version;
	}
	htmlCode_str += '" id="' + id + '" width="' + width + '" height="' + height + '" align="' + align + '">';
	htmlCode_str += '<param name="allowScriptAccess" value="' + allowScriptAccess + '">';
	htmlCode_str += '<param name="movie" value="' + movie + 'ActiveX">';
	htmlCode_str += '<param name="loop" value="' + loop + '">';
	htmlCode_str += '<param name="menu" value="' + menu + '">';
	htmlCode_str += '<param name="quality" value="' + quality + '">';
	htmlCode_str += '<param name="scale" value="' +scale + '">';
	htmlCode_str += '<param name="bgcolor" value="' + bgcolor + '">';
	htmlCode_str += '<param name="salign" value="' + salign + '">';
	htmlCode_str += '<param name="flashvars" value="' + flashvars + '">';
	htmlCode_str += '<param name="wmode" value="' + wmode + '">';
	htmlCode_str += '<embed src="' + movie + 'PlugIn" loop="' + loop + '" menu="' + menu + '" quality="' + quality + '" scale="' + scale + '" bgcolor="' + bgcolor + '" width="' + width + '" height="' + height + '" swLiveConnect=' + swLiveConnect + ' id="' + id + '" name="' + id + '" align="' + align + '" allowScriptAccess="' + allowScriptAccess + '" flashvars="' + flashvars + '" wmode="' + wmode + '" salign="' + salign + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><noembed>' + noembed + '</noembed>';
	htmlCode_str += '</object>';
	document.write(htmlCode_str);
}



