function popChat() {
    window.open('http://server.iad.liveperson.net/hc/39344047/?cmd=file&amp;file=visitorWantsToChat&amp;site=39344047&amp;AEPARAMS&amp;referrer='+document.location,'chat39344047','width=472,height=320');
}

function popCert(q) {
  var x = window.open('cert.asp' + '?section=' + q ,'winMslssDialog','width=373,height=300,screenX=150,screenY=150,left=150,top=150,scrollbars=no,status=no,resizable=no');
  x.focus();
}

function popHelp(helpItem) {
  var x = window.open('help/?helpItem=' + helpItem ,'winMslssPopupHelp','width=650,height=400,screenX=20,screenY=20,left=20,top=20,scrollbars=yes,status=yes,resizable=yes');
  x.focus();
}
// Fuling fixa detta 
function popPrefs(prefItem) {
  var x = window.open('prefs.asp?prefItem=' + prefItem + 'Pref.asp' ,'winMslssPopupPrefs','width=540,height=340,screenX=20,screenY=20,left=20,top=20,scrollbars=yes,status=no,resizable=no');
  x.focus();
}
function popApps(URL) {
  var x = window.open(URL,'winMslssPopupPrefs','screenX=0,screenY=0,left=0,top=0,scrollbars=yes,status=yes,resizable=yes');
  x.focus();
}
function popAction(actionItem) {
  var x = window.open( actionItem + '.asp' ,'winMslssPopupAction','width=540,height=340,screenX=20,screenY=20,left=20,top=20,scrollbars=yes,status=no,resizable=no');
  x.focus();
}
function popPrint(printItem) {
  var x = window.open( 'printLayout.asp?page=' + printItem ,'winMslssPopupPrint','width=780,height=500,screenX=20,screenY=20,left=20,top=20,scrollbars=yes,status=no,resizable=yes, menubar=yes');
  x.focus();
}
function markRow(caller) {
	var idArray = caller.getAttribute("id").split("_");
	var setActionLabel = 0;
	if (document.getElementById('actionLabel_' + idArray[0])) {
		setActionLabel = document.getElementById('actionLabel_' + idArray[0]);
	}
	if (caller.checked) {
		document.getElementById(idArray[0]+"_row_"+idArray[1]).className = 'lstRowHL';
		if (setActionLabel != 0) {
			setActionLabel.className = 'actionSelectHL';
		}
	}
	else {
		if (idArray[1] % 2 == 0) {
			document.getElementById(idArray[0]+"_row_"+idArray[1]).className = 'lstEvRow';
		}
		else {
			document.getElementById(idArray[0]+"_row_"+idArray[1]).className = 'lstOddRow';
		}
	}
	var stat = 0;
	var actionStat = 0;
	var input = document.getElementsByTagName("input");
	for (var i=0;input.length > i;i++) {
		if (input[i].getAttribute("type") == "checkbox"  && input[i].getAttribute("id")) {
		    if (input[i].getAttribute("id").match("^" + idArray[0] + "_(\\d+)$") != null) {
				if (input[i].checked == false) {
					stat++;
				}
				else {
					actionStat++;
				}
			}	
		}
	}
	if (stat > 0) {
		document.getElementById(idArray[0]).checked = false;
	}
	else {
		document.getElementById(idArray[0]).checked = true;
	}
	if (actionStat == 0) {
		if (setActionLabel != 0) {
			setActionLabel.className = 'actionSelect';
		}
	}
}

function markRows(caller) {
	var callerId = caller.getAttribute("id");
	var setActionLabel = 0;
	if (document.getElementById('actionLabel_' + callerId)) {
		setActionLabel = document.getElementById('actionLabel_' + callerId);
	}
	var input = document.getElementsByTagName("input");
	var tr = document.getElementsByTagName("tr");
	var actionList = new Array();
	for (var i=0;tr.length > i;i++) {
		if (tr[i].getAttribute("id") && tr[i].getAttribute("id")) {
			if (tr[i].getAttribute("id").match("^" + callerId + "_row_(\\d+)$") != null) {
				actionList.push(tr[i]);
			}
		}    
	}
	for (var i=0;input.length > i;i++) {
		if (input[i].getAttribute("type") == "checkbox" && input[i].getAttribute("id")) {
			if (input[i].getAttribute("id").match("^" + callerId) != null) {
    			input[i].checked = document.getElementById(callerId).checked;
			}
		}
	}
	for (var i=0;actionList.length > i;i++) {
		if (document.getElementById(callerId).checked) {
			actionList[i].className = 'lstRowHL';
		}
		else {
			if (i % 2 == 0) {
				actionList[i].className = 'lstOddRow';
			}
			else {
				actionList[i].className = 'lstEvRow';
			}
		}
	}
	if (setActionLabel != 0) {
		if (document.getElementById(callerId).checked) {
			setActionLabel.className = 'actionSelectHL';
		}
		else {
			setActionLabel.className = 'actionSelect';
		}
	}

}

function disableItems() {
	var args = disableItems.arguments;
	for (var i=0; i < args.length; i++) {
		document.getElementById(args[i]).disabled = true;
	}
}
function enableItems() {
	var args = enableItems.arguments;
	for (var i=0; i < args.length; i++) {
		document.getElementById(args[i]).disabled = false;
	}
}

function checkItems() {
	var args = checkItems.arguments;
	for (var i=0; i < args.length; i++) {
		document.getElementById(args[i]).checked = true;
	}
}

function activateLiveHelp() {
    var livehelpform  = frames.livehelpIframe.document.livehelpform;
    livehelpform.submit();
}

function activateSecureLiveHelp( livehelpSessionId, livehelpTimestamp) {
    var livehelpform  = frames.livehelpIframe.document.livehelpform;
    livehelpform.pageId.value = livehelpSessionId;
    livehelpform.pageDate.value = livehelpTimestamp;
    
    var htmlStart = '<?xml version="1.0" encoding="utf-8"?>\n'
        + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
        + '<html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it">\n';
    var htmlEnd = '</html>\n';
    
    livehelpform.pageHtml.value = htmlStart+document.documentElement.innerHTML+htmlEnd;
    livehelpform.submit();
}

function breakOutOfFrame() {
    var isInsideOwnFrameset = parent.frames['mainContent'] == self;
    var isInsideEBookingFrameset = parent.frames['right'] == self;

    if ( isInsideOwnFrameset || isInsideEBookingFrameset) {
        parent.location.href = document.location.href ;
    }
}

function demoPopup(filename, windowname, width, height, addFunc) {
    var demoWindow;
    var xw = width;	
    var xh = height;

	if((parseInt(navigator.appVersion)) > 3) { 
        var xxw = (screen.width-xw)/2; 
        var xxh = (screen.height-xh)/2 
    }
	else { 
        var xxw = 80; 
        var xxh = 80; 
    }

	demoWindow = open(filename, windowname,'width=' +width +',height=' + height + ',top=' + xxh + ',left=' + xxw + ',' + addFunc );
	demoWindow.focus();
}

