function getObj(name) {
	if (document.getElementById) {
		return document.getElementById(name);
	} else if (document.all) {
		return document.all[name];
	}
}

function closePopup() {
	
	var newsyearList = document.getElementById("ctl00_mainContent_NewsList_NewsYearDropDown");
    if(newsyearList != undefined)
        newsyearList.style.visibility = 'visible';
    
	getObj("flashcontent").style.width = "0%";
	getObj("flashcontent").style.height = "0%";
	
	delete window.onresize;
	delete window.onscroll;
}

function closeMapPopup()
{
    //Show the select component if they were hidden (IE6)
	var countryList = document.getElementById("ctl00_mainContent_ddlCountry");
    var cityList = document.getElementById("ctl00_mainContent_ddlCity");
    if(cityList != undefined)
    {
        countryList.style.visibility = 'visible';
	    cityList.style.visibility = 'visible';
    }
    getObj("flashcontent").style.width = "0%";
	getObj("flashcontent").style.height = "0%";
	
	delete window.onresize;
	delete window.onscroll;
}

function getSwf(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}

function getYOffset() {       
	var yPos = 0;
	if (window.innerHeight) {
		yPos = window.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		yPos = document.documentElement.scrollTop;
	} else if (document.body) {
		yPos = document.body.scrollTop;
	}
	return yPos;
}

function updateSize() {
	var popupDiv = getObj("flashcontent");
	var cHeight = 0;
	var cWidth = 0;
	if (window.innerWidth) {
		cWidth = window.innerWidth;
		cHeight = window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		cWidth = document.documentElement.clientWidth;
		cHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		cWidth = document.body.clientWidth;
		cHeight = document.body.clientHeight;
	}
	
	popupDiv.style.top = getYOffset()+"px";
	popupDiv.style.width = cWidth+"px";
	popupDiv.style.height = cHeight+"px";
	
}

function showPopup(xmlPath, rootPath, productId, languageCode, page, systemFonts) {
	
	updateSize();
	
	if(so) so = null;
	
	var so = new SWFObject(xmlPath+"floorsPopup.swf", "flashPopup", "100%", "100%", "9", "#FFFFFF");
	var xmlString = rootPath + "LoadProductXml.aspx?productid="+productId + "%26epslanguage="+languageCode;
	so.addParam("wmode", "transparent");
	so.addVariable("xml", xmlString);
	so.addVariable("lang", languageCode);
	so.addVariable("font", xmlPath + "fonts/");
	so.addVariable("page", page);
	so.addVariable("systemfonts", systemFonts);
	so.write("flashcontent");
	
	if(document.forms[0]) window.flashPopup = document.forms[0].flashPopup;

	window.onscroll = updateSize;
	window.onresize = updateSize;
	
	
}

function showPopupNews(xmlPath, xmlUrlEncodedString, languageCode) {
	
	updateSize();
	
	if(so) so = null;
	                                                                                                                                                    
	var so = new SWFObject(xmlPath+"floorsPopup.swf", "flashPopup", "100%", "100%", "9", "#FFFFFF");
	
	so.addParam("wmode", "transparent");
	so.addVariable("xmlContent", xmlUrlEncodedString);
	so.addVariable("lang", languageCode);
	so.addVariable("font", xmlPath + "fonts/");
	so.addVariable("page", "news");
	so.write("flashcontent");
	
	if(document.forms[0]) window.flashPopup = document.forms[0].flashPopup;
	
	window.onscroll = updateSize;
	window.onresize = updateSize;

    var newsyearList = document.getElementById("ctl00_mainContent_NewsList_NewsYearDropDown");
    newsyearList.style.visibility = 'hidden';                                                                                               
}

function showMapPopup(xmlPath, xmlSrc, languageCode) {
	
	updateSize();
	
	if(so) so = null;
	
	var so = new SWFObject(xmlPath+"mapPopup.swf", "flashPopup", "100%", "100%", "9", "#FFFFFF");
	
	so.addParam("wmode", "transparent");
	so.addVariable("xmlContent", xmlSrc);
	so.addVariable("font", xmlPath + "fonts/");
	so.addVariable("mapSrc", xmlPath + "as2map.swf");
	so.addVariable("lang", languageCode);
	so.write("flashcontent");
	
	if(document.forms[0]) window.flashPopup = document.forms[0].flashPopup;

	window.onscroll = updateSize;
	window.onresize = updateSize;
	
	var countryList = document.getElementById("ctl00_mainContent_ddlCountry");
    var cityList = document.getElementById("ctl00_mainContent_ddlCity");
    countryList.style.visibility = 'hidden';  
    cityList.style.visibility = 'hidden'; 
}

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
