var win=null;


function LoadLeftNav()
{


document.write('<div id="top">');
document.write('mobiel-bellen.com&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;eerlijk en helder advies');
document.write('</div>');


document.write('<div id="leftnav">');

document.write('<ul id="navigation">');
document.write('<li class="left"><a href="../Customer/introductie.aspx">Home</a></li>');
document.write('</ul><br>');
document.write('<ul id="navigation">');
document.write('<li class="left"><a href="../Mobiel/main.aspx">Mobiele telefonie</a></li>');
document.write('</ul><br>');
document.write('<ul id="navigation">');
document.write('<li class="left"><a href="../Vast/main.aspx">Vaste telefonie</a></li>');
document.write('</ul><br>');
document.write('<ul id="navigation">');
document.write('<li class="left"><a href="../Customer/contact.aspx">Contact</a></li>');
document.write('</ul><br>');

//document.write('<ul id="navigation">');
//document.write('<li class="left"><a href="/SMS/SelectVoucher.asp">Download Isync</a></li>');
//document.write('</ul><br>');

document.write('<div style="margin-top:30px;margin-left:25px;"><a href="http://klant.mobiel-bellen.com" target="_blank">Klant login</a></div>');

document.write('</div>');


}


function LoadFooter()
{
document.write('<div id="footer">');
document.write('&nbsp;&nbsp;&nbsp;&nbsp;&copy; vof mobiel-bellen.com');
document.write('</div>');
}


function NewWindow(mypage,myname)
  {
  var w=1024;
  var h=720;
  var pos='center';
  var infocus='front';
  if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
  if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
  else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
  settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";win=window.open(mypage,myname,settings);
  win.focus();
  }

function GoSearch(cmd)
{
    srch=document.getElementById('MySearch').value;
    location.href = "?Item="+cmd+"&MySearch="+srch;
}

function doDelete(myurl)
{
var answer=confirm('Weet u zeker dat u dit record wilt verwijderen?');
if (answer) {location.href=myurl }
}


// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}

function IsHex(sText)
{
   sText=sText.toUpperCase(); 
   var ValidChars = "0123456789ABCDEF";
   var IsHex=true;
   var Char;
   for (i = 0; i < sText.length && IsHex == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsHex = false;
         }
      }
   return IsHex;
   }

function IsNumeric(sText)
{
   var ValidChars = "0123456789.,+-%";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

/**
 * DHTML date validation script for dd/mm/yyyy. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "-";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	dtStr=dtStr.replace("/",dtCh)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : dd"+dtCh+"mm"+dtCh+"yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}

function isISODate(dtobject)
{

	var daysInMonth = DaysArray(12);
        var dt=dtobject.value;
        if (dt.length!=8) return(false);
        if (isInteger(dt)==false)  return(false);

	var strDay=dt.substring(6)
	var strMonth=dt.substring(4,6)
	var strYear=dt.substring(0,4)

	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)

	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYear)

	if (strMonth.length<1 || month<1 || month>12){
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		return false
	}
return true
}


function ajaxReq()
{
	var ajaxRequest; 

	try{ ajaxRequest = new XMLHttpRequest(); // Opera 8.0+, Firefox, Safari
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxRequest.open("GET", "?cmd=ajax&" + Math.random(), false);
	ajaxRequest.send(null);
	document.getElementById('BreezzID').value=ajaxRequest.responseText;
}


function ajaxSync2(myvar1,myvar2,myvar3,cmd)
{
	var ajaxRequest;  // The variable that makes Ajax possible!

	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	SetStatus('Checking server');
	ajaxRequest.open("GET", "/ajax.asp?ajax="+cmd+"&myvar1="+myvar1 + "&myvar2=" + myvar2 + "&myvar3=" + myvar3 + "&" + Math.random(), false);
	ajaxRequest.send(null);
	var MyResult=ajaxRequest.responseText;
        //alert(MyResult);
	SetStatus('Received response');
	return MyResult;
}

function ajaxrequest(req)
{
	var ajaxRequest;  // The variable that makes Ajax possible!

	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	if (req.indexOf("?",0)<0) req=req+"?" + Math.random(); else req=req+"&" + Math.random();
	ajaxRequest.open("GET", req, false);
	ajaxRequest.send(null);
	return ajaxRequest.responseText;
}


function PrepareDate(ElementID)
{
var myDate=new Date();
var myval=ElementID.value;
myval=myval.replace(/\s/g,"");
myval=myval.replace(/[^0-9]/g,"-");

if (myval.length<5) { return;}
var pos=myval.lastIndexOf("-");
if (pos<1) return;
if (myval.substr(pos+1).length==1) {myval=myval.substr(0,pos+1)+"0"+myval.substr(pos+1); } 
pos=myval.lastIndexOf("-");
if (myval.substr(pos+1).length==2) 
{
  myval=myval.substr(0,pos+1)+"20"+myval.substr(pos+1);  
  if (Number(myval.substr(pos+1))>Number(myDate.getFullYear()+10)) {myval=myval.substr(0,pos+1)+"19"+myval.substr(pos+3); }
}
var pos1=myval.indexOf("-");
if (pos1==1) {myval="0"+myval;}
pos=myval.lastIndexOf("-");
pos1=myval.indexOf("-");
if (pos-pos1==2) {myval=myval.substr(0,pos1+1)+"0"+myval.substr(pos-1);}
ElementID.value=myval;
}

