// Opens the browser's print window
/*function printWindow() {
	window.print();
	return false;
}
*/

//Set the page domain
//document.domain = 'organization.org';

var windowStyle = "toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=470";

// Open popup window
function openWindow(theURL) { //v2.0
	var oWin = window.open(theURL, "", windowStyle);
	if (oWin==null || typeof(oWin)=='undefined') {
		alert('You have a popup blocker installed. Please, deactivate it in order to execute iWeb correctly.');
	}
	else
	{
		oWin.focus();
	}
	//window.showModalDialog(theURL, null,"toolbar:no;status:no;menubar:no;scrollbars:yes;resizable:yes;width:700;height:470");
}

function openWindow(theURL, winName) { //v2.0
	var oWin = window.open(theURL, winName, windowStyle);
	if (oWin==null || typeof(oWin)=='undefined') {
		alert('You have a popup blocker installed. Please, deactivate it in order to execute iWeb correctly.');
	}
	else
	{
		oWin.focus();
	}
}

function openRichWindow(theURL, winName, windowStyle) { //v2.0
	var oWin = window.open(theURL, winName, windowStyle);
	if (oWin==null || typeof(oWin)=='undefined') {
		alert('You have a popup blocker installed. Please, deactivate it in order to execute iWeb correctly.');
	}
	else
	{
		oWin.focus();
	}
}

// Open popup window including escape
function openWindowEscape(theURL) { 
	theURL = escape(theURL);
	window.open(theURL, "", windowStyle);
}


//*********DANIEL
function openModalWindow(anURL, winName) {
  
    var oWin;
    if (window.showModalDialog) 
    {
        oWin = window.showModalDialog(anURL, winName, windowStyle);
        
        if (oWin==null || typeof(oWin)=='undefined') 
        {
		    alert('You have a popup blocker installed. Please, deactivate it in order to execute iWeb correctly.');
	    }	    
    } 
    else 
    {
        oWin = window.open(anURL, winName, 'toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=470,directories=no,menubar=no,modal=yes');
        //window.open(anURL, winName, 'height=255,width=250,toolbar=no,directories=no,status=no, continued from previous linemenubar=no,scrollbars=no,resizable=no ,modal=yes');
        
        if (oWin==null || typeof(oWin)=='undefined') 
        {
		    alert('You have a popup blocker installed. Please, deactivate it in order to execute iWeb correctly.');
	    }    
    }
}

function openModalWindow(anURL) 
{       
    var winName = ''; 
    var oWin;
    if (window.showModalDialog) 
    {
        oWin = window.showModalDialog(anURL, winName, windowStyle);
        
        /*
        if (oWin==null || typeof(oWin)=='undefined') 
        {
		    alert('You have a popup blocker installed. Please, deactivate it in order to execute iWeb correctly.');
	    }
	    */	    
    } 
    else 
    {
        oWin = window.open(anURL, winName, 'toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=470,directories=no, continued from previous linemenubar=no, modal=yes');
        //window.open(anURL, winName, 'height=255,width=250,toolbar=no,directories=no,status=no, continued from previous linemenubar=no,scrollbars=no,resizable=no ,modal=yes');
        
        if (oWin==null || typeof(oWin)=='undefined') 
        {
		    alert('You have a popup blocker installed. Please, deactivate it in order to execute iWeb correctly.');
	    }    
    }
}
    

//*******DANIEL end


var isIweb=1

// Community Management status changed.
function CheckHiddenValue()
{
	var counter = 0;
	var statusChanged = 'false';
	
	while(document.getElementById("dlCurrentCommunities__ctl"+ counter +"_chkCurrentCommunities") != null)
	{
		if (!document.getElementById("dlCurrentCommunities__ctl"+ counter +"_chkCurrentCommunities").checked)
		{
			statusChanged = 'true';
		}
		
		counter++;
	}
	
	counter = 0;
	while(document.getElementById("dlOtherCommunities__ctl"+ counter +"_chkOtherCommunities") != null)
	{
		if (document.getElementById("dlOtherCommunities__ctl"+ counter +"_chkOtherCommunities").checked)
		{
			statusChanged = 'true';
		}
		
		counter++;
	}
	
	
	if (statusChanged == 'true')
	{
		if (window.confirm('Your settings have changed. Do you want to save these changes?'))
		{
			document.getElementById("hidConfirmResponse").value = 'true';
		}
		else
		{
			document.getElementById("hidConfirmResponse").value = 'false';
		}
	}	
}

/* FloatingDiv Start*/
function displayLoadingMessage()
{
	var loadingDiv = document.getElementById('loadingDiv');
	if (loadingDiv != null)
	{
		loadingDiv.style.display = "block";
		loadingDiv.className= "loading";
		startScroll = 1;		
	}
}

self.onError=null;
currentX = currentY = 0;  
whichIt = null;           
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
FF = (NS || IE) ? 0 : 1;
startScroll = 0;

function timerHandler() {
	if (startScroll == 1)
	{
		if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
		if(FF) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
		if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
		if(diffY != lastScrollY) {
			percent = .1 * (diffY - lastScrollY);
			if(percent > 0) percent = Math.ceil(percent);
			else percent = Math.floor(percent);
			if(IE) document.all.loadingDiv.style.pixelTop += percent;
			if(FF) 
			{ 
				posY = 0;
				if (document.getElementById('loadingDiv').style.top != '')
					posY = parseInt(document.getElementById('loadingDiv').style.top, 10);
				document.getElementById('loadingDiv').style.top = posY + percent + "px";
			}
			if(NS) document.loadingDiv.top += percent;
			lastScrollY = lastScrollY + percent;
		}
		if(diffX != lastScrollX) {
			percent = .1 * (diffX - lastScrollX);
			if(percent > 0) percent = Math.ceil(percent);
			else percent = Math.floor(percent);
			if(IE) document.all.loadingDiv.style.pixelLeft += percent;
			if(FF) 
			{
				posX = 0;
				if (document.getElementById('loadingDiv').style.left != '')
					posX = parseInt(document.getElementById('loadingDiv').style.left, 10);				
				document.getElementById('loadingDiv').style.left = posX + percent + "px";
			}
			if(NS) document.loadingDiv.left += percent;
			lastScrollX = lastScrollX + percent;
		}
	}
}

if(NS || IE || FF) action = window.setInterval("timerHandler()",1);


/* FloateingDiv End */

