<!--

function openPopUp(imgUrl,pageTitle,pageParam) {
    var popWin=window.open('','',pageParam);
    var popWinDoc=popWin.document;
    var contentPopWin="<html>"+
                      "<head>"+
                      "<title>"+pageTitle+"</title>"+
                      "</head>"+
                      "<body leftmargin='0' rightmargin='0' marginwidth='0' topmargin='0' marginheight='0'>"+
                      "<div align='center'><img src='"+ imgUrl +"'></div>"+
                      "</body>"+
                      "</html>";
    popWinDoc.write(contentPopWin);
    popWinDoc.close;

}
function checkUN()
{
	open('./check.cgi?action=check&username='+document.signup.username.value,'displayWindow','width=200,height=100,status=no,scrollbars=no,screenX=300,screenY=100');
}

function md_add_domains()
{
    window.location.href = "?action=md,add_domains";
}

function md_add_emails()
{
    window.location.href = "?action=md,add_emails";
}

function expand(role)
{
    if(role==1 || role==2){
        if (document.getElementById)
	document.getElementById('pass1').style.display = 'block';
    else if (document.all)
	document.all['pass1'].style.display = 'block';
    else if (document.layers)
	document.layers['pass1'].style.display = 'block';
    else
	alert('sorry');	

    }
    else
    {
    if (document.getElementById)
	document.getElementById('pass1').style.display = 'none';
    else if (document.all)
	document.all['pass1'].style.display = 'none';
    else if (document.layers)
	document.layers['pass1'].style.display = 'none';
    else
	alert('sorry');	
    
    
    }
    if(role==1 || role==2){
        if (document.getElementById)
	document.getElementById('pass2').style.display = 'block';
    else if (document.all)
	document.all['pass2'].style.display = 'block';
    else if (document.layers)
	document.layers['pass2'].style.display = 'block';
    else
	alert('sorry');	

    }
    else
    {
    if (document.getElementById)
	document.getElementById('pass2').style.display = 'none';
    else if (document.all)
	document.all['pass2'].style.display = 'none';
    else if (document.layers)
	document.layers['pass2'].style.display = 'none';
    else
	alert('sorry');	
    
    
    }
    
}


    function md_delete_box(domainid,boxid, boxname)
    {

        if(window.confirm("Are you sure you want to delete filter for "+boxname+" ?"))
	{
	    window.location.href = "?action=md,delete_box&domainid="+domainid+"&boxid="+boxid;
	}
    }

    function md_delete_domain(domainid, domain)
    {

        if(window.confirm("Are you sure you want to delete filter for domain "+domain+" ?"))
	{
	    window.location.href = "?action=md,delete_domain&domainid="+domainid;
	}
    }


function monitor_contact_delete(contactid,name)
{
    if(window.confirm("Are you sure you want to delete the contact" + name +" ?")){
	    window.location.href = "?action=monitor,contacts,delete_contact&contactid="+contactid;
    }
}


function monitor_server_delete_sensor(name,sensorid,serverid)
{
    if(window.confirm("Are you sure you want to delete sensor " + name +" ?")){
	    window.location.href = "?action=monitor,servers,delete_sensor&sensorid="+sensorid+"&serverid="+serverid;
    }
}

function resolve_host()
{
     window.location.href = "?action=monitor,servers,add_server_1&name="+window.document.server_settings.name.value+"&description="+window.document.server_settings.description.value+"&subuserid="+window.document.server_settings.subuserid.value;
}


function monitor_delete_server(name,serverid,subuserid)
{
    if(window.confirm("Are you sure you want to delete server " + name +" ?")){
	    window.location.href = "?action=monitor,servers,delete_server&serverid="+serverid+"&subuserid="+subuserid;
    }
}

function expand(role)
{
    if(role==1 || role==2){
    if (document.getElementById)
	document.getElementById('pass1').style.display = 'block';
    else if (document.all)
	document.all['pass1'].style.display = 'block';
    else if (document.layers)
	document.layers['pass1'].style.display = 'block';
    else
	alert('sorry');	

    }
    else
    {
    if (document.getElementById)
	document.getElementById('pass1').style.display = 'none';
    else if (document.all)
	document.all['pass1'].style.display = 'none';
    else if (document.layers)
	document.layers['pass1'].style.display = 'none';
    else
	alert('sorry');	
    
    
    }
    if(role==1 || role==2){
        if (document.getElementById)
	document.getElementById('pass2').style.display = 'block';
    else if (document.all)
	document.all['pass2'].style.display = 'block';
    else if (document.layers)
	document.layers['pass2'].style.display = 'block';
    else
	alert('sorry');	

    }
    else
    {
    if (document.getElementById)
	document.getElementById('pass2').style.display = 'none';
    else if (document.all)
	document.all['pass2'].style.display = 'none';
    else if (document.layers)
	document.layers['pass2'].style.display = 'none';
    else
	alert('sorry');	
    
    
    }
    
}




function showSNMPCommunity(enabled)
{
    if(enabled)
    {
	if (document.getElementById)
	    document.getElementById('snmp_community_inp').style.display = '';
	else if (document.all)
	    document.all['snmp_community_inp'].style.display = '';
	else if (document.layers)
	    document.layers['snmp_community_inp'].style.display = '';
	else
	    alert('sorry');	
    }
    else
    {
	if (document.getElementById)
	    document.getElementById('snmp_community_inp').style.display = 'none';
	else if (document.all)
	    document.all['snmp_community_inp'].style.display = 'none';
	else if (document.layers)
	    document.layers['snmp_community_inp'].style.display = 'none';
	else
	    alert('sorry');	
    }
    
}


function showMySQLSettings(enabled)
{
    if(enabled)
    {
	if (document.getElementById)
	    document.getElementById('mysql_settings_inp').style.display = '';
	else if (document.all)
	    document.all['mysql_settings_inp'].style.display = '';
	else if (document.layers)
	    document.layers['mysql_settings_inp'].style.display = '';
	else
	    alert('sorry');	
    }
    else
    {
	if (document.getElementById)
	    document.getElementById('mysql_settings_inp').style.display = 'none';
	else if (document.all)
	    document.all['mysql_settings_inp'].style.display = 'none';
	else if (document.layers)
	    document.layers['mysql_settings_inp'].style.display = 'none';
	else
	    alert('sorry');	
    }
    
}

function enlarge(width_,height_,img_url,title)
{
    var x = screen.width/2-width_/2;
    var y = screen.height/2-height_/2;
    
    mywin = open('/enlarge.cgi?img_url='+img_url, title, 'width='+width_+',height='+height_+',status=no,toolbar=no,scrollbars=yes,top='+y+',left='+x);
}

function open_popup(url,width_,height_,title)
{
    var x = screen.width/2-width_/2;
    var y = screen.height/2-height_/2;
    
    mywin = open(url, title, 'width='+width_+',height='+height_+',status=no,toolbar=no,scrollbars=yes,top='+y+',left='+x);
}



var http_request = false;

function ajax_request(url,obj) 
{
    var txt;
    http_request = false;

    if (window.XMLHttpRequest)   // Mozilla, Safari,...
    { 
	http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
    	    http_request.overrideMimeType('text/xml');
        }
    }
    else
	 if(window.ActiveXObject) // IE
	 { 
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } 
	    catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = alertContents;
        http_request.open('GET', url, true);
        http_request.send(null);

    function alertContents() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
	    	var body = document.getElementById(obj); 
		body.innerHTML = http_request.responseText;
            } else {
                alert('There was a problem with the request.');
            }
        }
	return txt;

    }
}


function superadmin_delete_banner(bannerid)
{
    if(window.confirm("Are you sure you want to delete this banner ?"))
    {
        window.location.href = "?action=superadmin,misc,delete_banner&bannerid="+bannerid;
	}
}

function show_payout_methods(method)
{
    if(method==0)
    {
	document.getElementById('payout_bank_1').style.display = 'none';
	document.getElementById('payout_bank_2').style.display = 'none';
	document.getElementById('payout_bank_3').style.display = 'none';
	document.getElementById('payout_paypal_1').style.display = 'none';
    }

    if(method==1)
    {
	document.getElementById('payout_bank_1').style.display = '';
	document.getElementById('payout_bank_2').style.display = '';
	document.getElementById('payout_bank_3').style.display = '';
	document.getElementById('payout_paypal_1').style.display = 'none';
    }
    
    if(method==2)
    {
    	document.getElementById('payout_bank_1').style.display = 'none';
	document.getElementById('payout_bank_2').style.display = 'none';
	document.getElementById('payout_bank_3').style.display = 'none';

	document.getElementById('payout_paypal_1').style.display = '';
    }	
}

function ihelp(id)
{
    var txt;
    var txt2;
    var http_request = false;
    
    alert('stage1');
    var url = "/?action=misc,ihelp&poorwindow=1&id="+id;
    
    if(window.XMLHttpRequest)	// Mozilla, Safari,...
    { 
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType){
    	    http_request.overrideMimeType('text/xml');
        }
    }
    else
    {
	if(window.ActiveXObject) // IE
	{
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } 
	    catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
    }

    if (!http_request) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    
    http_request.onreadystatechange = alertContents;
    http_request.open('GET', url, true);
    http_request.send(null);
    
    function alertContents()
    {
        if (http_request.readyState == 4)
	{

            if (http_request.status == 200)
	    {
		txt = http_request.responseText;
		txt2 = http_request.responseText;
//		alert(txt2);
            }
	    else {
                alert('There was a problem with the request.');
            }
        }
	return txt;
    }
    alert(txt2);
    
    return txt2;
    

}

function ajax_external_source(url, obj)
{
    var txt;
    var http_request = false;

    if(window.XMLHttpRequest)	// Mozilla, Safari,...
    { 
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType){
    	    http_request.overrideMimeType('text/xml');
        }
    }
    else
    {
	if(window.ActiveXObject) // IE
	{
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } 
	    catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
    }

    if (!http_request) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    
    http_request.onreadystatechange = alertContents;
    http_request.open('GET', url, true);
    http_request.send(null);
    
    function alertContents()
    {
        if (http_request.readyState == 4)
	{

            if (http_request.status == 200)
	    {
	    	var body = document.getElementById(obj); 
		body.innerHTML = http_request.responseText;
//		var reg = new RegExp("ENABLE_SENSOR");
//		var str = http_request.responseText + "KKK";
		//var str = "tomer@netscent.com";

//		if (reg.test(str))
//		{
//		    alert(str);
//    		    var ppp = document.getElementById(obj2);
//		    ppp.checked=1;
//		}   
//		else{
//		    alert("NOT OK");
//		} 
            }
	    else {
                alert('There was a problem with the request.');
            }
        }
	return txt;
    }
}

function ajax_support(url, obj)
{
    var txt;
    var http_request = false;

    if(window.XMLHttpRequest)	// Mozilla, Safari,...
    { 
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType){
    	    http_request.overrideMimeType('text/xml');
        }
    }
    else
    {
	if(window.ActiveXObject) // IE
	{
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } 
	    catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
    }

    if (!http_request) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    
    http_request.onreadystatechange = alertContents;
    http_request.open('GET', url, true);
    http_request.send(null);
    
    function alertContents()
    {
        if (http_request.readyState == 4)
	{

            if (http_request.status == 200)
	    {
	    	var body = document.getElementById(obj); 
		body.innerHTML = http_request.responseText;
//		var reg = new RegExp("ENABLE_SENSOR");
//		var str = http_request.responseText + "KKK";
		//var str = "tomer@netscent.com";

//		if (reg.test(str))
//		{
//		    alert(str);
//    		    var ppp = document.getElementById(obj2);
//		    ppp.checked=1;
//		}   
//		else{
//		    alert("NOT OK");
//		} 
            }
	    else {
                alert('There was a problem with the request.');
            }
        }
	return txt;
    }
}


//-->




