/* -----------------------------------------------
Title: Common script
Author: Jarid Love
Modified: 02 Sept 2010 by Chris Coray
Comment: Added "hide iframe" functions for Media Gallery/header issues 
----------------------------------------------- */

/* Environment Variables
---------------------------------------------------- */
var isExternalHdr = false;
var isSSL = (location.protocol == "https:")?true:false;
var isStage = (location.href.indexOf("stage") > 0 || location.href.indexOf("usability") > 0) ? true : false;
var isTest = (location.href.indexOf("wwwtest.provo.novell.com") > 0  || location.href.indexOf("wwwqatest.provo.novell.com") > 0) ? true : false;
var isDev = (location.href.indexOf("wwwdev.provo.novell.com") > 0) ? true : false;
var allowRedirect = (location.href.indexOf("forceRedirect=false") > 0) ? false: true;

function getSecureUrl() {
	return (isDev)?"https://secure-wwwdev.provo.novell.com":(isTest)?"https://secure-wwwtest.provo.novell.com":(isStage)?((location.href.indexOf("usability") > 0)?"http://usabilitytest.novell.com":"https://secure-wwwstage.provo.novell.com"):"https://secure-www.novell.com";
}

var s = (isDev)?"http://wwwdev.provo.novell.com":(isTest)?"http://wwwtest.provo.novell.com":(isStage)?((location.href.indexOf("usability") > 0)?"http://usabilitytest.novell.com":"http://wwwstage.provo.novell.com"):"http://www.novell.com";
var n_server = s;
var ss = (isSSL)? getSecureUrl() : s;
var n_domain = location.host; 
var n_dirs = location.pathname.split("/");
var n_root = (n_dirs.length>=2)?n_dirs[1]:null;
var n_root2 = (n_dirs.length>=3)?n_dirs[2]:null;
var n_root3 = (n_dirs.length>=4)?n_dirs[3]:null;
var n_root4 = (n_dirs.length>=5)?n_dirs[4]:null;

var isDOM = document.getElementById?true:false; // all DOM based browsers including IE
var isNS4 = document.layers?true:false;
var isIE = document.all?true:false;
var isMac = (navigator.appVersion.indexOf("Mac") != -1)?true:false;
var isWin = (navigator.appVersion.indexOf("Win") != -1)?true:false;
var isLinux = (navigator.platform.indexOf("Linux") != -1)?true:false;
var usragent = navigator.userAgent.toLowerCase();
var isOperaBadDom = (usragent.substr(usragent.indexOf("opera")+6,1)<=6)?true:false; // this detects opera 6 or below which have crappy DOM support
var isOperaGoodDom = (usragent.substr(usragent.indexOf("opera")+6,1)>6)?true:false;
var isKonqueror = (usragent.indexOf("konqueror")>=0)?true:false;
var isPlone = (typeof is_plone != 'undefined') ? is_plone : false;
var is404Page = (typeof is404Page != "undefined") ? is404Page : false;

/* Cookie Functions
---------------------------------------------------- */
function readCookie(name) {
	var cks = document.cookie.split(';');
	for(var i=cks.length-1; i >= 0; i--) {
		var c = cks[i];
		while(c.charAt(0)===' ') {
			c = c.substring(1,c.length);
		}
		if(c.indexOf(name+"=")===0) {
			return c.substring(name.length+1,c.length);
		}
	}
	return null;
}

function deleteCookie(name,path,domain) {
	if(readCookie(name)) { document.cookie = name + "=" +
		((path) ? ";path=" + path : ";path=/") +
		((domain) ? ";domain=" + domain : ";domain=.novell.com") +
		";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
}

function createCookie(name,value,days,path,domain) {
	var expires = "";
	if(days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	document.cookie = name+"="+value+expires +
		((path) ? ";path=" + path : ";path=/") +
		((domain) ? ";domain=" + domain : ";domain=.novell.com");
}

/* Localization Functions
---------------------------------------------------- */
function getPageCharset() {
	var mt = document.getElementsByTagName('meta');
	for(var i=0; i<mt.length; i++) {
		var ct = mt[i].getAttribute('content');
		if(ct !== null && ct.toLowerCase().indexOf('charset=') != -1) {
			return ct.substring(ct.toLowerCase().indexOf('charset=')+8);
		}
	}
	return "UTF-8";
}

var n_lang = readCookie("novell_language");
var n_country = readCookie("novell_country");
var n_cnt=(n_country!==null && n_country.length>3)?n_country.substring(0,2):"US";
var n_cntName= (n_country!==null && n_country.length>3)?n_country.substring(3):"United States";
var n_enc = getPageCharset();

function siteSupportsLang() {
	if(isDOM) {
		var n_lang_sites = ["supporttest.provo.novell.com","supportstage.provo.novell.com","support.novell.com",s.substring(7,s.length),ss.substring(8,ss.length)]; // sites that support localization
		for(var i = n_lang_sites.length-1;i > -1; i--) {
			if(n_domain == n_lang_sites[i]) {
				return true;
			}
		}
	}
	return false;
}
var isLangCompatible = siteSupportsLang();
var langCompatible = isLangCompatible; // for legacy support

function isNonEnglishDir(dir) {
	if(dir === null) {
		return false;
	}
	var langDirs = ["de-de","es-es","fr-fr","it-it","nl-nl","cs-cz","zh-cn","zh-tw","ja-jp","hu-hu","pl-pl","pt-br","ru-ru","sv-se","fi-fi","da-dk","no-no","tr-tr"];
	for(var i = langDirs.length-1; i > -1; i--) {
		if(langDirs[i] == dir) {
			return true;
		}
	}
	return false;
}

function isCountryDir(dir) {
	if(dir === null) {
		return false;
	}
	var coDirRegex = new RegExp("^[A-Z][A-Z]$");
	if(coDirRegex.test(dir)) {
		return true;
	}
	return false;
}

function isFilteredRootDir(dir) {
	switch(dir) {
		case "communities" :
		case "rc" :
		case "cgi-bin" :
		case "servlet" :
		case "global" :
		case "ICSLogin" :
		case "ICHAINLogout" :
			return true;
		default :
			return false;
	}
}

function setLang(lang) {
	createCookie("novell_language",lang,365);
	n_lang = lang;
}

function setCountry(co,coname) {
	createCookie("novell_country",co+"|"+coname,(co === "") ? 0 : 365);
	n_cnt = co;
	n_cntName = coname;
	n_country = readCookie("novell_country");
}

function setDefaultCountryForLang(lang) {
	switch(lang) {
		case "it-it" : 
			setCountry("IT","Italia");
			break;
		case "ja-jp" : 
			setCountry("JP","Japan");
			break;
		case "zh-cn" : 
			setCountry("CN","&#20013;&#22269;");
			break;
		case "nl-nl" : 
			setCountry("NL","Nederland");
			break;
		case "sv-se" : 
			setCountry("SE","Sverige");
			break;
		case "pl-pl" : 
			setCountry("PL","Polska");
			break;
		case "no-no" : 
			setCountry("NO","Norge");
			break;
		case "cs-cz" : 
			setCountry("CZ","&#268;esk&#225; republika");
			break;
		case "hu-hu" : 
			setCountry("HU","Magyarorsz&#225;g");
			break;
		case "fi-fi" :
			setCountry("FI","Suomi");
			break;
		case "ru-ru" :
			setCountry("RU","Rossiya");
			break;
		case "tr-tr" :
			setCountry("TR", "Turkey");
			break;
	}
}

function getNovellTranslation(arry) {
	var txt = arry[n_lang];
	if(!txt) {
		txt = arry["en-us"];
	}
	return txt;
}

/* Localization Redirect
---------------------------------------------------- */
if(isCountryDir(n_root)) {
	window.location.replace(location.href.replace("/"+n_root,"")); // root dir should never be CO dir
}
if(isLangCompatible && !is404Page) {
	if(n_lang===null) {
		// no lang set so set it and leave on current page
		if(typeof defaultPageLang != "undefined" && typeof defaultPageCntry != "undefined") {
			// variables set to override lang/co settings so just set vars to match - just show page in this lang, but don't set cookies
			n_lang = defaultPageLang;
			n_country = defaultPageCntry;
			n_co_array = n_country.split("|");
			n_cnt = n_co_array[0];
			n_cntName = n_co_array[1];
		}
		else {
			// default to lang of current lang dir
			setLang(isNonEnglishDir(n_root) ? n_root : "en-us");
			setDefaultCountryForLang(n_lang);
		}
	}
	else if(allowRedirect===true && !isFilteredRootDir(n_root) &&  (isPlone || location.pathname.indexOf(".htm") >= 0 || location.pathname.lastIndexOf('/') == location.pathname.length-1)) {
		if(isNonEnglishDir(n_root) && n_root != n_lang) {
			// user navigated to different lang dir then setting so change language
			n_lang = n_root;
			setLang(n_lang);
			setDefaultCountryForLang(n_lang);
		}
		if(isCountryDir(n_root2) && n_root2 != n_cnt) {
			// user navigated to different country dir so change country
			n_cnt = n_root2;
			document.write('<script type="text/javascript" src="/common/util/langsetcountry.php?lang='+n_lang+'&&co='+n_cnt+'"><\/script>'); // call external script to set country cookie because we have to look up country name
		}
		if((n_lang == "en-us" && isNonEnglishDir(n_root)) ||
			(n_lang != "en-us" && n_root != n_lang) ||
			(n_root2 === null && n_cnt != "US") ||
			(isCountryDir(n_root2) && n_cnt != n_root2) ||
			(n_lang == n_root && n_root2 !== null && (n_root2.length == 2 || isPlone) && n_root2 != n_cnt)
		) {
			if(readCookie("novell_lang_redirect_refer")===null){ //only set value if one has not already been set
				createCookie("novell_lang_redirect_refer", document.referrer, 1);
			}
			
			// not in correct lang location
			if(isPlone && location.pathname.indexOf("home") < 0) {
				// file is plone generated so redirect to lang path
				var targetUrl = location.protocol+"//"+location.hostname;
				if(n_lang != "en-us" || (n_lang == "en-us" && n_cnt != "US")) {
					targetUrl += "/"+n_lang;
					if(n_cnt != "US") {
						targetUrl += "/"+n_cnt;
					}
				}
				var targetPath = (isNonEnglishDir(n_root) || n_root == "en-us") ?  location.pathname.substring(6) : location.pathname;
				targetPath = (n_root2 !== null && n_root2.length == 2 && n_root2.search(/[A-Z][A-Z]/) > -1) ? targetPath.substring(3) : targetPath;
				targetUrl += targetPath + location.search;
				if(targetUrl != location.href) {
					window.location.replace(targetUrl);
				}
			}
			else {
				// the following include checks the file system to see if there is a better location to redirect to based on country/lang
				document.write('<script type="text/javascript" src="/common/util/langredirect.php?url='+escape(location.href)+'"><\/script>');
			}
		}
	}
}
else if(n_lang == null) {
	n_lang = "en-us";
}

/* Include menu script, css, and local phone number
---------------------------------------------------- */
document.write('<script type="text/javascript" src="' + ss + '/ContactsOffices/geophone.jsp"><\/script>');
if(n_lang == "ja-jp"){
	document.write('<link rel="stylesheet" type="text/css" href="'+ss+'/common/inc/css/fonts_ja.css" />');
}

if(isDOM) { 
	if(window.name == "printer_friendly") {
		document.write('<link rel="stylesheet" type="text/css" href="'+ss+'/common/inc/printerfriendly.css" title="Printer Friendly" />');
		var s_prop15=location.href;
	}
	document.write('<script type="text/javascript" src="'+ss+'/common/inc/nav/main_2008.js"><\/script>');
	var hasHdrNav = true; 
}

function showPrinterFriendly() {
	if(document.getElementById("contentcontainer") || document.getElementById("pageContent") || (typeof jQuery != 'undefined' && ($('.pageContainer') || $('.contentContainer')))) {
		var pfwindow = window.open(location.href,"printer_friendly");
		pfwindow.focus();
	}
	else {
		window.open(s+'/inc/pf/pf.jsp?url='+escape(location.href)+'&sourceid=PrinterFriendlyFromFooter');
	}
}

/* login/out functions
---------------------------------------------------- */
function setLoginStatus() {
	var cks = document.cookie.split(';');
	for(var i=0; i < cks.length; i++) {
		var c = cks[i];
		while(c.charAt(0)===' ') {
			c = c.substring(1,c.length);
		}
		if(c.indexOf("IPC")===0 && c.indexOf("=")==16) {
			document.write('<script type="text/javascript" src="'+ss+'/inc/util/secure/userInfo.jsp"><\/script>');
		}
	}
}
var isLoggedIn = false;
setLoginStatus();

/* Misc functions
---------------------------------------------------- */
function rgb2hex(rgb) {
	rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
	function hex(x) {
		return ("0" + parseInt(x).toString(16)).slice(-2);
	}
	return hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}

function getBgColor(obj) {
	var obj = $(obj);
	do {
		var bgColor = obj.css("background-color");
		if(bgColor != "transparent" && bgColor != "rgba(0, 0, 0, 0)") {
			return bgColor;	
		}
		obj = obj.parent();
	} while(obj.tagName != "BODY" && obj.tagName != "HTML");
	return "transparent";
}

function getTxtImg(txt, size, lineHeight, isBold, color, bgcolor, width) {
	var imgUrl = ss+'/common/img/txt2img/?text='+encodeURI(txt);
	if(typeof color != 'undefined' && color) imgUrl += "&color="+color;
	if(typeof bgcolor != 'undefined' && bgcolor) imgUrl += "&bg="+bgcolor;
	if(typeof size != 'undefined' && size) imgUrl += "&size="+size;
	if(typeof lineHeight != 'undefined' && lineHeight) imgUrl += "&linespacing="+lineHeight;
	if(typeof isBold != 'undefined' && isBold == true) imgUrl += "&bold=true";
	if(typeof width != 'undefined' && width != null) imgUrl += "&w="+width;
	return '<img class="txt_img" src="'+imgUrl+'" alt="'+txt+'" onload="$(this).ifixpng();">';
}

function txtToImg(obj, isFixedWidth, bgcolor) {
	var container = (obj.size) ? obj : $(obj);
	var isBold = (container.css("font-weight") == "bold" || parseInt(container.css("font-weight")) > 400) ? true : false;
	var width = (isFixedWidth) ? container.width() : null;
	var bg = (typeof bgcolor && bgcolor) ? bgcolor : getBgColor(obj);
	bg = (bg.indexOf("rgb") > -1) ? rgb2hex(bg) : bg.replace("#","");
	var color = container.css("color");
	color = (color.indexOf("rgb") > -1) ? rgb2hex(color) : color.replace("#","");
	var size = parseInt(container.css("font-size"));
	var lineHeight = (container.css("line-height") == "normal") ? 1.5 : parseInt(container.css("line-height"))/size;
	var imgHtml = getTxtImg(container.text(), size, lineHeight, isBold, color, bg, width);
	container.empty().html(imgHtml);
}

if(n_lang == "ja-jp" && typeof $ != 'undefined'){
	document.write('<script type="text/javascript" src="/common/inc/ja-jp_customize.js"><\/script>');
}

function getQueryParm(name) {
	var params = document.params;
	if(!params) {
		document.params = (location.search.substring(1)).split("&");
		params = document.params;
	}
	for(var i = 0; i < params.length; i++) {
		var param = params[i].split("=");
		if(param[0] == name) {
			return param[1];
		}
	}
	return null;
}

function getRandomInt(min, max) {
	return (min >= max) ? max : Math.floor(((max+1 - min)*Math.random())+min);
}

function getItemWidth(obj) {
	var width = obj.clientWidth;
	return (width === 0) ? obj.offsetWidth : width;
}

function getItemHeight(obj) {
	var height = obj.clientHeight;
	return (height === 0) ? obj.offsetHeight : height;
}

function getXY(obj) {
	var intX = 0;
	var intY = 0;
	try {
		do { // Walk up our document tree until we find the body and add the distance from the parent to our counter.
			intX += obj.offsetLeft;
			intY += obj.offsetTop;
			obj = obj.offsetParent;
		} while(obj.tagName != "BODY" && obj.tagName != "HTML");
	}
	finally {
		return [intX,intY];
	}
}

/* RAC
---------------------------------------------------- */
var racUrl = "/common/inc/requestcall_smallform.html";
var inPageRAC = false;
function closeRAC() {
	if(inPageRAC) {
		$("#requestcall").remove().appendTo("#requestcallplaceholder").unwrap().removeClass("overlay");
		$("#racoverlaycontainer").remove();
		hideRACCanopy();
	}
	else {
		$("#racpopup").fadeOut("fast", function() {
			hideRACCanopy();
		});
	}
}

function displayRACPopup() {
	$("#racpopup").css({  
		"display": "block",
		"visibility": "hidden"
	});
	$("#racpopup").css({  
		"top": Math.max(($(window).height()-$("#racpopup").height())/2+$(window).scrollTop(),10),  
		"left": Math.max(($(window).width()-$("#racpopup").width())/2+$(window).scrollLeft(),10)
	});
	$("#racpopup").css({  
		"display": "none",
		"visibility": "visible"
	});
	$("#racpopup").fadeIn("fast");
	$("#raccanopy img").hide();
}

function addRACCanopy() {
	if($("#raccanopy").size() == 0) {
		$("body").append('<div id="raccanopy"><img src="'+n_server+'/common/img/racloader.gif" /></div>');
		$("#raccanopy").css("opacity","0.8").click(function() {
			closeRAC();
		});
	}
}

function showRACCanopy() {
	$("#raccanopy img").show();
	hidePlugins(true)
	$("#raccanopy").fadeIn("fast");
	if(isIE && parseInt($.browser.version) < 7) {
		$("#raccanopy").css("position", "absolute").width($(window).width()).height($(document).height());
	}
}

function hideRACCanopy() {
	$("#raccanopy").fadeOut("fast");
	showPlugins(true);
}

function addRACOverlay() {
	addRACCanopy();
	if($("#racpopup").size() == 0) {
		$("body").append('<div id="racpopup"><div id="racpopup_content"></div><div id="racpopup_ftr"><p><a href="#" onclick="closeRAC();return false;"><strong>Close</strong></a></p></div></div>');
	}
}

function highlightInpageRAC() {
	if(isIE && parseInt($.browser.version) < 9) {
		$("#requestcall").css("position","relative");
		$("#requestcall").queue("fx");
		$("#requestcall").animate({left:'+=10'},50);
		$("#requestcall").animate({left:'-=20'},100);
		$("#requestcall").animate({left:'+=20'},100);
		$("#requestcall").animate({left:'-=20'},100);
		$("#requestcall").animate({left:'+=10'},50);
	}
	else {
		$('#requestcall').animate({shadow: '0 0 25px #000'});
	}
}

function requestCall(url) {
	if(!location.href.indexOf(".novell.com")) {
		// open popup because not on novell.com server
		window.open(n_server+"/company/sales_call_request_popup.html", "rac", "width=600,height=650");
		return;
	}
	if($("#racpopup").size() > 0) {
		showRACCanopy();
		displayRACPopup();
	}
	else if($("#requestcall").size() > 0) {
		// rac form in page
		inPageRAC = true;
		$.scrollTo("#requestcall",500,{ onAfter:highlightInpageRAC, offset: {top:-20, left:0}, axis:'y' });
	}
	else {
		// rac form not in page so show overlay
		inPageRAC = false;
		addRACOverlay();
		showRACCanopy();
		if(n_lang != "en-us") {
			racUrl = "/"+n_lang+racUrl;
		}
		$.get(racUrl, function(data){
			$("#racpopup_content").html(data);
			displayRACPopup();
		},"html");
	}
}

function switchToNotice(noticeUrl) {
	if($("#racpopup").size() > 0) { // form is in popup
		$("#raccanopy img").show();
		$("#racpopup").fadeOut("fast", function() {
			$("#requestcall").css({ 
				"visibility": "hidden",
				"height": "1px",
				"width" : "1px",
				"position" : "absolute"
			});
			$("#racpopup").css("visibility","hidden");
	
			$.get(noticeUrl, function(data){
				$("#racpopup_content").append('<div class="home_tip">'+data+'</div>');
				displayRACPopup();
			},"html");
		});
	}
	else { // form is in page
		addRACOverlay();
		showRACCanopy();
		$.get(noticeUrl, function(data){
			$("#racpopup_content").html('<div class="home_tip">'+data+'</div>');
			displayRACPopup();
		},"html");
	}
	return false;
}

function showRACHome() {
	switchToNotice(n_server+"/"+n_lang+"/common/inc/requestcall_smallform_home_content.html");
	return false;
}

function showRACTech() {
	switchToNotice(n_server+"/"+n_lang+"/common/inc/requestcall_smallform_tech_content.html");
	return false;
}

function homeClick() {
	document.getElementById('salescallrequest').submit();
}

/* Popup functions
---------------------------------------------------- */
function openNovellPopup(url) {
	openIframePopup(url);
}

function openIframePopup(url) {
	addRACCanopy();
	$("body").append('<div id="iframepopup"><div id="iframepopup_content"><iframe id="iframepopup_iframe" src="'+url+'" onload="setTimeout(displayIframePopup, 10)" frameborder="0" scrolling="no" /></div><div id="iframepopup_ftr"><p><a href="#" onclick="closeIframePopup();return false;"><strong>Close</strong></a></p></div></div>');
	$("#raccanopy").click(function() {
		closeIframePopup();
	});
	showRACCanopy();
}

function displayIframePopup() {
	//this function gets called anytime a new URL loads in the iframe. Since sometimes a thank you page will be loaded inside the iframe, we need to make sure the popup isn't visible before proceeding. if it's visible, then this is a "thank you" page being loaded, and so we simply return since we want the page to come up normally within the iframe.
	if($("#iframepopup").css("visibility") == "visible"){
		return false;
	}

	$("#iframepopup").css({  
		"visibility": "hidden",
		"display": "block"
	});
	
	$('#iframepopup_iframe').height(($('#iframepopup_iframe').contents().height()+1)+"px");
	$('#iframepopup_iframe').width($('#iframepopup_iframe').contents().width()+"px");

	$("#iframepopup").css({  
		"top": Math.max(($(window).height()-$("#iframepopup").height())/2+$(window).scrollTop(),10),  
		"left": Math.max(($(window).width()-$("#iframepopup").width())/2+$(window).scrollLeft(),10),
		"display": "none",
		"visibility": "visible"
	});
	$("#iframepopup").fadeIn("fast");
	$("#raccanopy img").hide();
}

function closeIframePopup() {
	$("#iframepopup").fadeOut("fast", function() {
		$("#raccanopy").fadeOut("fast", function() {
			$("#iframepopup, #raccanopy").remove();
		});
	});
}

function openPopup() {  // Function for opening links from flash; variables stored on individual pages
	if(typeof openUrl == 'undefined') {
		return false;
	}
	window.open(openUrl,'_blank',addParams);
}

function openExternal(URL, w, h, s, n, r) { // open link in new window (for external links)
	// It is possible to bypass w and h by passing in 'noW', 'noH'
	var attr = "";
	if(typeof w != "undefined" && w!= 'noW') {
		attr += "width=" + w;
	}
	if(typeof h != "undefined" && h != 'noH') {
		attr += ",height=" + h;
	}
	if(attr.length > 0) { // when no width or height is specified, use window core defaults, do not add any other values
		attr += (typeof s != "undefined" && s === true) ? ',scrollbars=yes' : ',scrollbars=no'; // default on sized window = no scrollbars
		attr += (typeof r != "undefined" && r === false) ? ',resizable=no' : ',resizable=yes'; // default on sized window = resizable
	}
	if(attr.charAt(0)==",") {
		attr = attr.substring(1);
	}
	if(URL.indexOf("play.php") != -1){
		assetClick(URL, false);
	}
	var winExt = (!n) ? window.open(URL,'_blank',attr) : window.open(URL,n,attr);
	if(winExt && winExt.blur) {
		winExt.focus();
	}
}

/* Functions to hide/show plugins (ie. flash)
---------------------------------------------------- */
function hideFlash(hideall) {
	$("object, embed").each(function(){
		var y = $(this).offset().top;
		if ((y > 0 && y < 500) || (typeof hideall != 'undefined' && hideall == 'all')) {
			$(this).css("visibility", "hidden");
		}
	});
}

function hidePlugins(hideall) {
	// hide select boxes in IE versions > 7 because they show through menus
	var agt=navigator.userAgent.toLowerCase();
	if(isIE && parseInt($.browser.version) < 7) {
		$("select").css("visibility","hidden");
	}
	// hide flash content because it shows through navigation
	if(typeof flash != "undefined") {
		// if flash.forcehide, hide property has been manually set
		// if linux, wmode not supported, so hide flash
		// if flash version is less than 6,0,79,0 hide flash because wmode not supported widely
		if(flash.forcehide || isLinux || (flash.version <= 6 && flash.rev < 79) || isOperaGoodDom) {
			hideFlash(hideall);
		}
	}
	if(typeof SWFObject != "undefined") {
		var swfObj = new SWFObject();
		if((swfObj.installedVer.major < 6 && swfObj.installedVer.rev < 79) || isLinux || isOperaGoodDom){
			hideFlash(hideall);
		}
	}
	if(typeof frames != "undefined") {
		$("iframe[src*=http://www.novell.com/huddle/event/index.php]").each(function(){
			var getHeight = $(this).height();
			$("#videoembed").height(getHeight);
			$("#videoembed").css({"background-color":"#333"});
			$(this).css({"display":"none"});
		});
	}
	hiddenElmnts = true;
}

function showFlash(hideall) {
	$("object, embed").each(function(){
		var y = $(this).offset().top;
		if ((y > 0 && y < 500) || (typeof hideall != 'undefined' && hideall == 'all')) {
			$(this).css("visibility", "visible");
		}
	});
}

function showPlugins(hideall) {
	// show select boxes in IE versions > 7 that were hidden because they show through menus
	var agt=navigator.userAgent.toLowerCase();
	if(isIE && parseInt($.browser.version) < 7) {
		$("select").css("visibility","inherit");
	}
	// show flash content that was hidden because it shows through navigation
	if(typeof flash != "undefined") {
		if(flash.forcehide || isLinux || (flash.version <= 6 && flash.rev < 79) || isOperaGoodDom) {
			showFlash(hideall);
		}
	}
	if(typeof SWFObject != "undefined") {
		var swfObj = new SWFObject();
		if((swfObj.installedVer.major < 6 && swfObj.installedVer.rev < 79) || isLinux || isOperaGoodDom){
			showFlash(hideall);
		}
	}
	if(typeof frames != "undefined") {
		$("iframe[src*=http://www.novell.com/huddle/event/index.php]").each(function(){
			$("#videoembed").css({"background":"transparent"});
			$(this).css({"display":"block"});
		});
	}
	hiddenElmnts = false;
}
