var strRootFolder = '';

//=======================================================================================================================

sfHover = function() {
var sfEls

if ( document.getElementById("nav")){

	sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
	
	        if(document.getElementById("menu_iframe1")) {
				var iframe = document.getElementById("menu_iframe1");

				var submenu = this.getElementsByTagName("ul");
				if(submenu.length) {
					iframe.style.top = submenu[0].offsetTop + this.offsetTop + 78;
					iframe.style.left = submenu[0].offsetLeft + this.offsetLeft;
					iframe.style.width = submenu[0].scrollWidth + 2;
					iframe.style.height = submenu[0].clientHeight;
					iframe.style.display = "inline";
				}
			}
			if(document.getElementById("menu_iframe2")) {
				var iframe2 = document.getElementById("menu_iframe2");

				var submenu2 = this.getElementsByTagName("ul");
				if(submenu2.length) {
					iframe2.style.top = submenu2[1].offsetTop + this.offsetTop + 139;
					iframe2.style.left = submenu2[1].offsetLeft + this.offsetLeft + 1;
					iframe2.style.width = submenu2[1].scrollWidth + 2;
					iframe2.style.height = submenu2[1].clientHeight + 1;
					iframe2.style.display = "inline";
				}
			}	
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			
	        if(document.getElementById("menu_iframe1")) {
				var iframe = document.getElementById("menu_iframe1");
				iframe.style.display = "none";
			}
			if(document.getElementById("menu_iframe2")) {
				var iframe2 = document.getElementById("menu_iframe2");
				iframe2.style.display = "none";
			}
		}
	}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//=======================================================================================================================

function scroll_me(flag)
{
	document.getElementById(flag).className='current';
	document.location="#" + flag;
}

//=======================================================================================================================

function openWindow(contentURL,windowName,features) {
	contentURL = strRootFolder + '/Modules/ImageGallery/'+ contentURL
	newWindow = window.open(contentURL,windowName,features);
	newWindow.focus()
	}

function openPreview(contentURL,windowName,features) {
	contentURL = strRootFolder + '/Modules/Campaigns/'+ contentURL
	newWindow = window.open(contentURL,windowName,features);
	newWindow.focus()
	}	

function changeImage(whichImage,id,pmid,height,width,ttl,txt) {

	var featured = window.document.getElementById("Featured");
	var enlarge = window.document.getElementById("Enlarge");
	var caption = window.document.getElementById("FeaturedCaption");	
	
	var windowwidth = width + 35;
	var windowheight = height + 100;
	
	featured.src = '/Images/ImageGallery/' + pmid + '/' + whichImage;
	enlarge.href = 'javascript:openWindow(\'popEnlarge.aspx?iid=' + id + '&pmid=' + pmid + '&link=enlarge&height=' + height + '&width=' + width + '\',\'Details\',\'scrollbars=yes,resizable=yes,width=' + windowwidth + ',height=' + windowheight + '\');';

	if (ttl.length > 0)	
	{
		if (txt.length > 0)
			{
			caption.innerHTML =  '<strong>' + ttl + '</strong>' + ' - '+ txt;
			}
		else
			{
			caption.innerHTML =  '<strong>' + ttl + '</strong>';
			}
	}
	else
	{
		if (txt.length > 0)
			{
			caption.innerHTML =  txt;
			}
	}
}

function FCKUpdateLinkedField(id)
{
    try
    {
        if(typeof(FCKeditorAPI) == "object")
        {
            FCKeditorAPI.GetInstance(id).UpdateLinkedField();
        }
    }
    catch(err)
    {
    }
}
