﻿// global variables
var popUpDivClassName = "popUpDivClass";
var pageLoaded = false;
var SelectedDropDown = '';

// This function creates an opaque overlay div 
// and adds the content of the contentPopup parameter to the center of the overlay
function CreateOverlayPopUpWindow(contentPopupId, closeButtonText, entityId) {
	if (CreateOuterOverlay(contentPopupId, closeButtonText, entityId))
		CreateOverlayContent(contentPopupId, closeButtonText, entityId);
}

// This function creates an opaque overlay div 
// and adds the content of the contentPopup parameter to the center of the overlay
function CreateFlightTicketsOverlayPopUpWindow(contentPopupId, closeButtonText, url, selectId) {
	if (CreateOuterOverlay(contentPopupId, closeButtonText, null)) {
		if (selectId != 'undefined' && selectId != null) {
			RememberSelection(selectId);
			SelectedDropDown = selectId;
		}
		CreateFlightOverlayContent(contentPopupId, closeButtonText, url);
	}
}

// This function creates an opaque overlay div for the google pop-up only
// and adds the content of the contentPopup parameter to the center of the overlay
function CreateGoogleOverlayPopUpWindow(contentPopupId, closeButtonText, entityId, score, url) {
	if (pageLoaded) {
		if (CreateOuterOverlay(contentPopupId, closeButtonText, entityId))
			CreateGoogleOverlayPopupContent(contentPopupId, closeButtonText, entityId, score, url);
	}
}

// This checks if the user accepts cookies. If it doesn't than the popup is not displayed
// NOTE: The test cookie is added in the control for the site selection overlay
function CheckCookie() {
    if (document.cookie == "") {
        return false;
    } else {
        return true;
    }
}

function CreateOuterOverlay(contentPopupId, closeButtonText, entityId) {
	var wucPopUpOverlayExtender = document.getElementById(contentPopupId);
	var lTempDivId = "tempDiv_" + contentPopupId;
	if (wucPopUpOverlayExtender == null) {
		//only show the pop-up when the overlay external control
		//in rendered into the page
		var tempDiv = document.getElementById(lTempDivId);
		if (tempDiv != null)
		//removes the div from page
			tempDiv.parentNode.removeChild(tempDiv);
		return false;
	}

	//set banners visibility
	//solution for the overlay banner pop-up problem
	ShowFlashObjects(false);
	ShowCountryFlashMap(false);
	ShowFrames(false);

	//create the overlay div
	var modalDiv = document.getElementById(lTempDivId);
	if (modalDiv == null) {
		modalDiv = document.createElement("div");
		modalDiv.name = lTempDivId;
		modalDiv.id = lTempDivId;

		if (typeof (tempDivClassName) != 'undefined') {
			//for syndication pages, it is set in the syndication pages
			modalDiv.className = tempDivClassName;
		}
		else {
			modalDiv.className = "modalBackground";
			modalDiv.style.width = screen.width + 'px';
			modalDiv.style.height = screen.height + 'px';

			if (typeof (BrowserDetector.browser) == 'undefined') {
				BrowserDetector.init();
			}
			if ((BrowserDetector.browser == 'IE' || BrowserDetector.browser == 'Explorer') && BrowserDetector.version < 7) {
				modalDiv.className += " modalBackgroundIE";
				modalDiv.style.height = document.body.offsetHeight;
			}
		}

		document.body.appendChild(modalDiv);
	}

	if (BrowserIsIE6())
	{
	    SetDropDownsVisibility(false);
    }
		
	return true;
}

function BrowserIsIE6() {
    return getInternetExplorerVersion() == 6;
}

// Returns the version of Internet Explorer or a -1 (indicating the use of another browser).
function getInternetExplorerVersion()
{
    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;
}

// show - bool value to show or hide drop down lists (true = visible)
function SetDropDownsVisibility(show) {
    if (typeof document.body.style.maxHeight == "undefined") // This returns "undefined" only for IE6
    {
        var ddls = document.getElementsByTagName("select");
        for (i = 0; i < ddls.length; i++) {
            ddls[i].style.visibility = show ? "visible" : "hidden";
        }
    }
}

function SetCustomVisibleDelay (timeout)
{
	setTimeout("setVisibility()", timeout);	
}

function setVisibility() {
    var div = document.getElementById("popupTopCloseButton");
    if (div != null) {
        div.style.display = "block";
    }
}

function CloseOverlay(lTempDivId, hideFlashMapCountry)
{
    var modalDiv = document.getElementById(lTempDivId);

    if (modalDiv != null) {
        if (BrowserIsIE6()) {
            SetDropDownsVisibility(true);
        }
    	modalDiv.style.display = "none";
    }    

    var popUpDiv = document.getElementById("temp_popupOverlayExternal");
    if(popUpDiv != null){
	    popUpDiv.style.display = "none";
	}
	
    //set banners visibility
    //solution for the overlay pop-up problem
	ShowFlashObjects(true);
	if (hideFlashMapCountry != true) {
		ShowCountryFlashMap(true);
	}
	ShowFrames(true);
	
	if (typeof (BrowserDetector.browser) == 'undefined') {
		BrowserDetector.init();
	}
	
	if (BrowserDetector.browser == 'Firefox' || BrowserDetector.browser == 'Mozilla') {
		//This piece of code makes sure that the videos from the page are not over the vertical supplier links if they are visible
		var lVerticalSuppliers = document.getElementById("SuppliersIFrame");
		if (lVerticalSuppliers != "undefined" && lVerticalSuppliers != null && lVerticalSuppliers.style.display == "block") {
			lVerticalSuppliers.contentWindow.document.body.innerHTML = lVerticalSuppliers.contentWindow.document.body.innerHTML;
			lVerticalSuppliers.style.display = "block";
		}
	}
}

function CloseOverlayFlight(lTempDivId) {
	var lHideFlash = false;
	if (SelectedDropDown.indexOf("flight_supp") > 0) {
		lHideFlash = true;
	}
	CloseOverlay(lTempDivId, lHideFlash);
	
	SetRememberSelections();
}

function CreateOverlayContent(contentPopupId, closeButtonText, entityId) 
{
    if (contentPopupId == 'InvisiblepopupOverlayExternal') {
        CreateExternalOverlayContent(contentPopupId, closeButtonText);
    }
    if (contentPopupId == 'SiteSelectionOverlayPopup') {
        CreateUserSiteSelectionOverlayContent(contentPopupId);
    }
   }

function CreateFlightOverlayContent(contentPopupId, closeButtonText, url) {
	var popUpDiv = document.getElementById("temp_popupOverlayExternal");

	if (popUpDiv == null) {
		popUpDiv = document.createElement("div");
		popUpDiv.name = "temp_popupOverlayExternal";
		popUpDiv.id = "temp_popupOverlayExternal";
		popUpDiv.className = popUpDivClassName;
		popUpDiv.style.left = Math.abs((screen.width - 990) / 2) + 145 + 'px';
		popUpDiv.style.top = 315 + 'px';
		document.body.appendChild(popUpDiv);
	}
	else {
		popUpDiv.style.display = "";
		document.getElementById("tempDiv_" + contentPopupId).style.display = "";
	}

	popUpDiv.innerHTML = "<div id='popupOverlayExternal' class='overlayExternal google-pop-up'>"
            + "<div id='popupTopCloseButton' onclick='CloseOverlayFlight(\"tempDiv_" + contentPopupId + "\")' class='close' style='cursor:pointer'>"
            + "<span>" + closeButtonText + "</span></div>"
            + "<iframe src='" + url + "' width='660' height='480' frameborder='0' marginheight='0' marginwidth='0' scrolling='no'></iframe>"
			+ "</div>";

	SetPopupScrollPosition(popUpDiv);   
}

function CreateExternalOverlayContent(contentPopupId, closeButtonText) 
{
    var popUpDiv = document.getElementById("temp_popupOverlayExternal");

    if (popUpDiv == null) {
        popUpDiv = document.createElement("div");
        popUpDiv.name = "temp_popupOverlayExternal";
        popUpDiv.id = "temp_popupOverlayExternal";
        popUpDiv.className = popUpDivClassName;
        popUpDiv.style.left = Math.abs((screen.width - 990) / 2) + 255 + 'px';
        popUpDiv.style.top = 10 + 'px';
        popUpDiv.innerHTML = "<div id='popupOverlayExternal' class='overlayExternal' style='width:550px'>"
            + "<div id='popupTopCloseButton' onclick='CloseOverlay(\"tempDiv_" + contentPopupId + "\")' class='topOverlayExternalCloseButton' style='display:none'>"
            + "<span>" + closeButtonText + "</span></div>"
			+ document.getElementById(contentPopupId).innerHTML
			+ "</div>";

        document.body.appendChild(popUpDiv);
    }
    SetCustomVisibleDelay(5000);
}

function CreateUserSiteSelectionOverlayContent(contentPopupId) {
    var popUpDiv = document.getElementById("temp_popupOverlayExternal");

    if (popUpDiv == null) {
    		popUpDiv = document.createElement("div");
        popUpDiv.name = "temp_popupOverlayExternal";
        popUpDiv.id = "temp_popupOverlayExternal";
        popUpDiv.className = popUpDivClassName;
        popUpDiv.style.top = 315 + 'px';
        popUpDiv.style.width = 'auto';
        popUpDiv.innerHTML = "<div id='popupOverlayExternal' class='overlayExternal'>"
			+ document.getElementById(contentPopupId).innerHTML
			+ "</div>";
        
        document.body.appendChild(popUpDiv);

        var lWidth = 0;
        if (popUpDiv.clientWidth)
        	lWidth = popUpDiv.clientWidth;
        if (lWidth != 0)
        	popUpDiv.style.marginLeft = Math.abs((screen.width - lWidth) / 2) + 'px';
    }
}

function CreateGoogleOverlayPopupContent(contentPopupId, closeButtonText, entityId, score, url) {
	var popUpDiv = document.getElementById("temp_popupOverlayExternal");

	if (popUpDiv == null) {
		popUpDiv = document.createElement("div");
		popUpDiv.name = "temp_popupOverlayExternal";
		popUpDiv.id = "temp_popupOverlayExternal";
		popUpDiv.className = popUpDivClassName;
		popUpDiv.style.left = Math.abs((screen.width - 990) / 2) + 145 + 'px';
		popUpDiv.style.top = 315 + 'px';
		document.body.appendChild(popUpDiv);
	}
	else
	{
		popUpDiv.style.display = "";
		document.getElementById("tempDiv_" + contentPopupId).style.display = ""; 
	}

	popUpDiv.innerHTML = "<div id='popupOverlayExternal' class='overlayExternal google-pop-up'>"
            + "<div id='popupTopCloseButton' onclick='CloseOverlay(\"tempDiv_" + contentPopupId + "\")' class='close' style='cursor:pointer'>"
            + "<span>" + closeButtonText + "</span></div>"
            + "<iframe src='" + url + "?entid=" + entityId + "&score=" + score
            + "' width='660' height='464' frameborder='0' marginheight='0' marginwidth='0' scrolling='no'></iframe>"
			+ "</div>";
			
	SetPopupScrollPosition(popUpDiv);
}

function SetPopupScrollPosition(popUpDiv)
{
	var lScrollY, lDefaultY = 100;

	if (window.scrollY)
		lScrollY = window.scrollY;
	else
		if (document.documentElement.scrollTop)
		lScrollY = document.documentElement.scrollTop;
	else
		lScrollY = document.body.scrollTop;

	popUpDiv.style.top = lScrollY + lDefaultY + 'px';
}

var BrowserDetect = {
	init: function() {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function(data) {
		for (var i = 0; i < data.length; i++) {
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function(dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
	},
	dataBrowser: [
		{ string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS: [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};

function SetPageLoaded() {
	pageLoaded = true;
}

BrowserDetect.init();

if (BrowserDetect.browser == 'Explorer') {
	window.onload = SetPageLoaded;
}
else {
	SetPageLoaded();
}

var BrowserDetector = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "IE",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};

function setBodyClassName ()
{
	var lBodyObject;
	var lBodyTags = document.getElementsByTagName ('body');

	if (lBodyTags != null && lBodyTags.length > 0)
	{
		BrowserDetector.init();
		lBodyObject = lBodyTags[0];
		if (lBodyObject.className != '')
		{
			lBodyObject.className = lBodyObject.className + ' ' + BrowserDetector.browser;
		}
		else
		{
			lBodyObject.className = BrowserDetector.browser;
		}
	}
}
// This file is cached. If you change the content of the file than it should be renamed to force the clients to get the new version.

Type.registerNamespace('NetMatch.Zoover.Web.Services.Binaries');
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService=function() {
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.initializeBase(this);
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.prototype={
_get_path:function() {
 var p = this.get_path();
 if (p) return p;
 else return NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.get_path();},
MarkEntityPhotoAsVisited:function(url,succeededCallback, failedCallback, userContext) {
return this._invoke(this._get_path(), 'MarkEntityPhotoAsVisited',false,{url:url},succeededCallback,failedCallback,userContext); },
GetVisitedEntityPhotoCounter:function(url,succeededCallback, failedCallback, userContext) {
return this._invoke(this._get_path(), 'GetVisitedEntityPhotoCounter',false,{url:url},succeededCallback,failedCallback,userContext); }}
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.registerClass('NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService',Sys.Net.WebServiceProxy);
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance = new NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService();
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.set_path = function(value) { NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.set_path(value); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.get_path = function() { return NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.get_path(); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.set_timeout = function(value) { NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.set_timeout(value); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.get_timeout = function() { return NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.get_timeout(); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.set_defaultUserContext = function(value) { NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.set_defaultUserContext(value); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.get_defaultUserContext = function() { return NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.get_defaultUserContext(); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.set_defaultSucceededCallback = function(value) { NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.set_defaultSucceededCallback(value); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.get_defaultSucceededCallback = function() { return NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.get_defaultSucceededCallback(); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.set_defaultFailedCallback = function(value) { NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.set_defaultFailedCallback(value); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.get_defaultFailedCallback = function() { return NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.get_defaultFailedCallback(); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.set_path("/Services/Binaries/PhotoStatisticsService.asmx");
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.MarkEntityPhotoAsVisited= function(url,onSuccess,onFailed,userContext) {NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.MarkEntityPhotoAsVisited(url,onSuccess,onFailed,userContext); }
NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService.GetVisitedEntityPhotoCounter= function(url,onSuccess,onFailed,userContext) {NetMatch.Zoover.Web.Services.Binaries.PhotoStatisticsService._staticInstance.GetVisitedEntityPhotoCounter(url,onSuccess,onFailed,userContext); }

Type.registerNamespace('NetMatch.Zoover.Web.MyZoover.Services');
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService = function() {
	NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.initializeBase(this);
	this._timeout = 0;
	this._userContext = null;
	this._succeeded = null;
	this._failed = null;
}
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.prototype = {
	_get_path: function() {
		var p = this.get_path();
		if (p) return p;
		else return NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.get_path();
	},
	GetLoginBox: function(mlmmCode, succeededCallback, failedCallback, userContext) {
		return this._invoke(this._get_path(), 'GetLoginBox', false, { mlmmCode: mlmmCode }, succeededCallback, failedCallback, userContext);
	},
	GetForgotPasswordBox: function(mlmmCode, succeededCallback, failedCallback, userContext) {
		return this._invoke(this._get_path(), 'GetForgotPasswordBox', false, { mlmmCode: mlmmCode }, succeededCallback, failedCallback, userContext);
	},
	PerformLogin: function(userEmail, userPassword, rememberMe, mlmmCode, succeededCallback, failedCallback, userContext) {
		return this._invoke(this._get_path(), 'PerformLogin', false, { userEmail: userEmail, userPassword: userPassword, rememberMe: rememberMe, mlmmCode: mlmmCode }, succeededCallback, failedCallback, userContext);
	},
	PerformLogout: function(mlmmCode, succeededCallback, failedCallback, userContext) {
		return this._invoke(this._get_path(), 'PerformLogout', false, { mlmmCode: mlmmCode }, succeededCallback, failedCallback, userContext);
	},
	ForgotPassword: function(email, mlmmCode, succeededCallback, failedCallback, userContext) {
		return this._invoke(this._get_path(), 'ForgotPassword', false, { email: email, mlmmCode: mlmmCode }, succeededCallback, failedCallback, userContext);
	},
	GetMyZooverProfiles: function(emailAddresses, succeededCallback, failedCallback, userContext) {
		return this._invoke(this._get_path(), 'GetMyZooverProfiles', false, { emailAddresses: emailAddresses }, succeededCallback, failedCallback, userContext);
	} 
}
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.registerClass('NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService', Sys.Net.WebServiceProxy);
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance = new NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService();
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.set_path = function(value) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.set_path(value); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.get_path = function() { return NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.get_path(); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.set_timeout = function(value) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.set_timeout(value); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.get_timeout = function() { return NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.get_timeout(); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.set_defaultUserContext = function(value) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.set_defaultUserContext(value); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.get_defaultUserContext = function() { return NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.get_defaultUserContext(); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.set_defaultSucceededCallback = function(value) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.set_defaultSucceededCallback(value); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.get_defaultSucceededCallback = function() { return NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.get_defaultSucceededCallback(); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.set_defaultFailedCallback = function(value) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.set_defaultFailedCallback(value); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.get_defaultFailedCallback = function() { return NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.get_defaultFailedCallback(); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.set_path("/MyZoover/Services/MyZooverUIService.asmx");
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.GetLoginBox = function(mlmmCode, onSuccess, onFailed, userContext) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.GetLoginBox(mlmmCode, onSuccess, onFailed, userContext); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.GetForgotPasswordBox = function(mlmmCode, onSuccess, onFailed, userContext) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.GetForgotPasswordBox(mlmmCode, onSuccess, onFailed, userContext); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.PerformLogin = function(userEmail, userPassword, rememberMe, mlmmCode, onSuccess, onFailed, userContext) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.PerformLogin(userEmail, userPassword, rememberMe, mlmmCode, onSuccess, onFailed, userContext); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.PerformLogout = function(mlmmCode, onSuccess, onFailed, userContext) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.PerformLogout(mlmmCode, onSuccess, onFailed, userContext); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.ForgotPassword = function(email, mlmmCode, onSuccess, onFailed, userContext) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.ForgotPassword(email, mlmmCode, onSuccess, onFailed, userContext); }
NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService.GetMyZooverProfiles = function(emailAddresses, onSuccess, onFailed, userContext) { NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService._staticInstance.GetMyZooverProfiles(emailAddresses, onSuccess, onFailed, userContext); }
var gtc = Sys.Net.WebServiceProxy._generateTypedConstructor;
Type.registerNamespace('NetMatch.Zoover.MyZoover');
if (typeof (NetMatch.Zoover.MyZoover.MyZooverProfileInformation) === 'undefined') {
	NetMatch.Zoover.MyZoover.MyZooverProfileInformation = gtc("NetMatch.Zoover.MyZoover.MyZooverProfileInformation");
	NetMatch.Zoover.MyZoover.MyZooverProfileInformation.registerClass('NetMatch.Zoover.MyZoover.MyZooverProfileInformation');
}

/*
This script is used for myZoover functionality
*/
var _LoginBoxContainerId = "myZooverLoginBoxContainer";
var _ForgotPasswordBoxContainerId = "MyZooverModalContent";
var _Email = "";

// Gets the HTML for the login box
function GetLoginBox() {
    var proxy = new NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService();
    proxy.GetLoginBox(getMlmmCode(), getLoginBoxHTML, onError);
}

// Gets the HTMl for the Forgot Password popup
function GetForgotPasswordBox() {
	var proxy = new NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService();
	proxy.GetForgotPasswordBox(getMlmmCode(), getForgotPasswordBoxHTML, onError);
}

// Performs the login
function PerformLogin(user, pass, rememberMe) {
    var proxy = new NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService();
    proxy.PerformLogin(user, pass, rememberMe, getMlmmCode(), doLoginResult, onError);
}

// Performs the logout
function DoLogout() {
    var proxy = new NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService();
    proxy.PerformLogout(getMlmmCode(), doLogoutResult);
}

// Performs the forgot password action on a myZoover account email
function ForgotPassword(email) {
	_Email = email;
	var proxy = new NetMatch.Zoover.Web.MyZoover.Services.MyZooverUIService();
	proxy.ForgotPassword(email, getMlmmCode(), ForgotPasswordResult);
}

// Shows the error message in case the forgot password did not work as expected
function ForgotPasswordResult(result) {
	if (result != '') { alert(result); }
	else {
		alert(Password_Remembered.replace("{0}", _Email));
		RemoveForgotPasswordModal();
	}
}

// Refresh the login box if the login was successful
function doLoginResult(result) {
    if (result != '') { alert(result); }
    else {
        GetLoginBox();
    }
}

// Renders the HTML in the login box container
function getLoginBoxHTML(result) {
    if (result != '') { $get(_LoginBoxContainerId).innerHTML = result; }
}

// Renders the HTML in the login box container
function getForgotPasswordBoxHTML(result) {
	if (result != '') { $get(_ForgotPasswordBoxContainerId).innerHTML = result; }
}

// Refresh the login box after the logout
function doLogoutResult(result, userContext, methodName) {
    GetLoginBox();
}

function onError(result) {
	// Don't do anything in case of error - the client shouldn't know about the error.
	//if (result.get_statusCode() != '0')
		//alert(result.get_message());
}

function getMlmmCode() {
    if (typeof (MLMMCode) == 'undefined') {
        alert('There is no SiteContext defined!');
    }
    return MLMMCode;
}

// DoLogin function used here is registered from code
function MyZooverKeyPress(event) {
    if (navigator.appName == 'Netscape') {
        if (event.which == 13) {
            event.cancelBubble = true;
            event.returnValue = false;
            DoLogin();
            return false;
        }
    }
    else {
        if (window.event.keyCode == 13) {
            window.event.cancelBubble = true;
            window.event.returnValue = false;
            DoLogin();
            return false;
        }
    }
    return true;
}

function DoForgotPassword() {
	var lEmail = document.getElementById('txtMyZooverFPEmail');
	if (lEmail.value != '') {
		ForgotPassword(lEmail.value);
	} else {
		alert(Error_EmailRequired);
	}
}

function ForgotPasswordModal() {
	ShowDropDownsIE6(false);

	ShowCountryFlashMap(false);

	ShowVideoPlayer(false);

	var modalDiv = document.getElementById("MyZooverModalBg");
	if (modalDiv == null) {
		modalDiv = document.createElement("div");
		modalDiv.name = "MyZooverModalBg";
		modalDiv.id = "MyZooverModalBg";
		modalDiv.className = "modalBackground";
		modalDiv.style.width = document.body.offsetWidth + 'px';
		modalDiv.style.height = screen.height + 'px';

		if (navigator.userAgent.toLowerCase().indexOf('msie 6') != -1) {
			modalDiv.className += " modalBackgroundIE";
			modalDiv.style.height = document.body.offsetHeight;
		}
		document.body.appendChild(modalDiv);
	}
	else {
		modalDiv.style.display = "block";
	}

	var popUpDiv = document.getElementById("MyZooverModalMainContainer");
	if (popUpDiv == null) {
		popUpDiv = document.createElement("div");
		popUpDiv.name = "MyZooverModalMainContainer";
		popUpDiv.id = "MyZooverModalMainContainer";
		popUpDiv.className = "popUpDivClassMyZoover";

		popUpWindow = document.createElement('div');
		popUpWindow.id = 'MyZooverModalContent';
		popUpWindow.className = "popUpDivClassMyZoover";

		popUpDiv.appendChild(popUpWindow);

		document.body.appendChild(popUpDiv);
	}
	else {
		popUpDiv.style.display = "block";
	}
	
	var left = (document.body.offsetWidth - 500) / 2;
	if (left < 0) left = 0;
	popUpDiv.style.left = left + "px";

	SetDefaultMyZooverModalTopPosition();

	GetForgotPasswordBox();
}

function RemoveForgotPasswordModal() {
	var modalDiv = document.getElementById("MyZooverModalBg");
	if (modalDiv != null) {
		modalDiv.style.display = "none";
	}

	var popUpDiv = document.getElementById("MyZooverModalMainContainer");
	if (popUpDiv != null) {
		popUpDiv.style.display = "none";
	}

	ShowCountryFlashMap(true);

	ShowVideoPlayer(true);

	ShowDropDownsIE6(true);
}

// show - bool value to show or hide drop down lists (true = visible)
function ShowDropDownsIE6(show) {
	if (typeof document.body.style.maxHeight == "undefined") // This returns "undefined" only for IE6
	{
		var ddls = document.getElementsByTagName("select");
		for (i = 0; i < ddls.length; i++) {
			ddls[i].style.visibility = show ? "visible" : "hidden";
		}
	}
}

function ShowVideoPlayer(show) {
	var videoPlayer = document.getElementById('frameVideoPlayer');
	if (videoPlayer != null) {
		if (show) {
			videoPlayer.style.visibility = 'visible';
		}
		else {
			videoPlayer.style.visibility = 'hidden';
		}
	}
}

function SetDefaultMyZooverModalTopPosition() {
	var lScrollY, lDefaultY = 250;
	var lMyZooverMainModalContainer;

	if (window.scrollY)
		lScrollY = window.scrollY;
	else
		if (document.documentElement.scrollTop)
		lScrollY = document.documentElement.scrollTop;
	else
		lScrollY = document.body.scrollTop;

	lMyZooverMainModalContainer = document.getElementById('MyZooverModalMainContainer');
	if (lMyZooverMainModalContainer != null) {
		lMyZooverMainModalContainer.style.top = lScrollY + lDefaultY + 'px';
	}
}
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();