﻿//clear textbox
function clearDefault(el) {
    if (el.defaultValue==el.value) el.value = "";
}

function setExtentions(el) {
    if (el.value == "") el.value = "[ .nl .be .com .eu .net .org ]";
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function shiftOpacity(id, millisec) {
    
    //if an element is invisible, make it visible, else make it ivisible
    if(document.getElementById(id).style.opacity == 0) {
        opacity(id, 0, 100, millisec);
    } else {
        opacity(id, 100, 0, millisec);
    }
} 

function fadein(id, millisec, toppx) {
    
    document.getElementById(id).style.display="block";
    document.getElementById(id).style.opacity = 0;
    if(document.getElementById(id).style.opacity == 0) {
        opacity(id, 0, 97, millisec);
    }
} 

function fadeout(id, millisec, toppx) {
    document.getElementById(id).style.display="none";
    document.getElementById(id).style.opacity = 0;
}

//Function to check al checkboxes in domaincheck
function CheckAll()
{
    count = document.forms[0].elements.length;
        
    var name="";
    var lengte = 0;
    var check = 1;
    
    for (i=0; i < count; i++) 
	{
	    name = document.forms[0].elements[i].name;
	    lengte = name.length;
    	if(name.substring(lengte-8,lengte)=="CB_order"){
	        document.forms[0].elements[i].checked = check; 
	    }
	    
	}
}

//Function to check invert checkboxes in domaincheck
function CheckInvert()
{
    count = document.forms[0].elements.length;   

    var name="";
    var lengte = 0;
    
    for (i=0; i < count; i++) 
	{ 
	    name = document.forms[0].elements[i].name;
	    lengte = name.length;
    	if(name.substring(lengte-8,lengte)=="CB_order"){
	        if(document.forms[0].elements[i].checked){
	           document.forms[0].elements[i].checked = 0; 
	        }
	        else{
	            document.forms[0].elements[i].checked = 1;
	        }	        
	    }
	}
}

function CheckInvertRadio(e)
{
    count = document.forms[0].elements.length;
    var name="";
    var lengte = 0;
    
    for (i=0; i < count; i++) 
	{
	    name = document.forms[0].elements[i].name;
	    lengte = name.length;
    	if(name.substring(lengte-8,lengte)=="RB_order"){
	        if (e.name == name){
	            document.forms[0].elements[i].checked = 1;
	        }
	        else{
	            document.forms[0].elements[i].checked = 0;
	        }	        
	    }
	}
}

function ValidateCheckbox(id, error)
{
    var checkvalid = document.getElementById(id).checked;
    if(!checkvalid){
        alert(error);
        return false;
    }
    else{
        return true;
    }
}

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else
    begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" + 
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

// create expire date as GMT
// [dP] - date part like D(day) M(month) or Y(year)
// [aM] = augmenter the quantity added
function setExpDate(dP, aM) {
	var endDate = new Date();
	if(dP == "M") {
	    var expMonth = endDate.getMonth() + aM;
	    endDate.setMonth(expMonth);
	} else if(dP == "Y") {
	    var expYear = endDate.getFullYear() + aM;
	    endDate.setFullYear(expYear);
	} else {
	    var expHour = endDate.getHours() + (aM*24);
	    endDate.setHours(expHour);
	}
	var expire = endDate.toGMTString();
	/* make GMT string because some servers do not recognize toGMTString correctly*/
	var datePart = expire.split(" ");
	var GMTDate = datePart[0]+ " " +datePart[1]+ " " +datePart[2]+ " " +datePart[3]+ " " +datePart[4] + " GMT";
	return GMTDate
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function mijnPlusHosting() {
    win = window.open('http://mijn.plushosting.nl', 'MijnPlusHosting', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}

function paneelPlusHosting() {
    win = window.open('http://paneel.plushosting.nl', 'PaneelPlusHosting', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}

function mailPlusHosting() {
    //win = window.open('https://mail.plushosting.nl', 'MailPlusHosting', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    win = window.open('https://mail.pins.nl/src/login.php', 'MailPlusHosting', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}

function mail2PlusHosting() {
    //win = window.open('http://mail2.plushosting.nl', 'MailPlusHosting', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    win = window.open('http://217.194.96.14/src/login.php', 'MailPlusHosting', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}

function olBackupApcare() {
    win = window.open('https://backup.onlinebackup.nl/obs/user/logon.do?locale=nl', 'OnlineBackupApcare', 'toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}

function helpdeskICMC() {
    win = window.open('http://help.icmc.nl', 'HelpdeskICMC', 'width=860,toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}

function serviceICMC() {
    win = window.open('http://service.icmc.nl/', 'ServiceICMC', 'width=860,toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}

function klantloginICMC() {
    win = window.open('http://www.icmc.nl/index.php?gbr=&wcht=&submit=login&icmcid=1882dd8494f85672e0c0345c5ca2b57f&-client=1&page=klantlogin&-secr=669841e57af2c226407a2249c3404d67&-topnav=&-html=false', 'KlantloginICMC', 'width=860,toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}

function mijnHECP() {
    win = window.open('http://cp.plushosting.com/', 'PaneelHostedExchange', 'width=860,toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}

function mijnHEWM() {
    win = window.open('http://owa.plushosting.com/', 'HostedExchangeWA', 'width=860,toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    return false;
}
