function Browser() {
  var b=navigator.appName;
  if (b=="Netscape") this.b="ns"
  else if (b=="Microsoft Internet Explorer") this.b="ie"
  else this.b=b
  this.version=navigator.appVersion
  this.v=parseInt(this.version)
  this.ns=(this.b=="ns" && this.v>=4)
  this.ns4=(this.b=="ns" && this.v==4)
  this.ns5=(this.b=="ns" && this.v==5)
  this.ie=(this.b=="ie" && this.v>=4)
  this.ie4=(this.version.indexOf('MSIE 4')>0)
  this.ie5=(this.version.indexOf('MSIE 5')>0)
  this.ie55=(this.version.indexOf('MSIE 5.5')>0)
  this.dom=((document.createRange&&(document.createRange().createContextualFragment))?true:false)
  this.min=(this.ns||this.ie)
  var ua=navigator.userAgent.toLowerCase()
  if (ua.indexOf("win")>-1) this.platform="win32"
  else if (ua.indexOf("mac")>-1) this.platform="mac"
  else this.platform = "other"
  }

brow = new Browser();

function getCurPageWidth(frames){
 if(brow.b== 'ie'){if (frames){widthPage=parent.document.all.top.clientWidth;}else{widthPage=document.body.clientWidth;}}
 else{widthPage=window.innerWidth;}return widthPage}

function getCurPageHeight(frames) {
 if (brow.b=='ie'){if (frames){heightPage=parent.document.all.top.clientHeight;}else{heightPage = document.body.clientHeight;}}
 else{heightPage=window.innerHeight;}return heightPage}

// date functions
//------------------------------------------------------------------------------

function sysDate() {
	now = new Date();

	dd = now.getDate();
	mm = now.getMonth()+1;
	yy = now.getFullYear();

//	if (yy < 100) yy += 1900;

	dd*=1; mm*=1; yy*=1;

	return "" 
	+ ((dd<10) ? "0" : "") + dd + "-" 
	+ ((mm<10) ? "0" : "") + mm + "-" 
	+ yy;
}

//------------------------------------------------------------------------------

function sysTime(){
	now = new Date();

	hh = now.getHours();
	mm = now.getMinutes();
	
	hh*=1; mm*=1;

	return "" 
	+ ((hh < 10) ? "0" : "") + hh + ":"
	+ ((mm < 10) ? "0" : "") + mm;
}
//------------------------------------------------------------------------------

function isLapYear(year){
	return !(year%4);
}

//------------------------------------------------------------------------------

function validDate(date){

	var datestr  = new String( date );
	var dateMask = /^(\d{1,2})\D(\d{1,2})\D(\d{2,4})$/;
	var dateparts = datestr.match( dateMask );

	if( !dateparts ) return null;

	var dd = dateparts[1];
	var mm = dateparts[2];
	var yy = dateparts[3];

	// force into numeric:
	dd*=1; mm*=1; yy*=1;

	if( yy < 50 )  yy += 2000;
	if( yy < 100 ) yy += 1900;

	if( mm < 1  ) return null;
	if( mm > 12 ) return null;
	if( dd < 1 )  return null;

	var maxdays = [31,28,31,30,31,30,31,31,30,31,30,31];
	if( isLapYear(yy) ) maxdays[1] = 29;

	if( dd > maxdays[mm-1] ) return null;

	return  "" + ((dd<10) ? "0" : "") + dd + "-" + ((mm<10) ? "0" : "") + mm + "-" + yy;;

}
//------------------------------------------------------------------------------

function validTime(time){

	var timestr  = new String( time );
	var timeMask = /^(\d{1,2})\D(\d{1,2})$/;
	var timeparts = timestr.match( timeMask );

	if( !timeparts ) return null;

	var hh = timeparts[1];
	var mm = timeparts[2];

	// force into numeric:
	hh*=1; mm*=1;

	if( hh < 0  ) return null;
	if( hh > 23 ) return null;

	if( mm < 0  ) return null;
	if( mm == 60 ){
			alert( "Om " + hh + ":60 is het " + (hh+1) + ":00." );
	}
	if( mm > 59 ) return null;

	return ""
	+ ((hh < 10) ? "0" : ":") + hh + ":"
	+ ((mm < 10) ? "0" : ":") + mm;

}


function initCaps(frmObj) {
  var index;
  var tmpStr;
  var tmpChar;
  var preString;
  var postString;
  var strlen;
  tmpStr = frmObj.value.toLowerCase();
  strLen = tmpStr.length;
  if (strLen > 0)  {
    for (index = 0; index < strLen; index++)  {
      if (index == 0)  {
        tmpChar = tmpStr.substring(0,1).toUpperCase(); 
        postString = tmpStr.substring(1,strLen);
        tmpStr = tmpChar + postString;
        }
      else {
        tmpChar = tmpStr.substring(index, index+1);
        if ((tmpChar == " " || tmpChar == "-") && index < (strLen-1))  {
          tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
          preString = tmpStr.substring(0, index+1);
          postString = tmpStr.substring(index+2,strLen);
          tmpStr = preString + tmpChar + postString;
          }
        }
      }
    }
    frmObj.value = tmpStr;
  };



function getCheck(frm, fld){
  s = eval("document.forms."+frm+"."+fld)
  if (s.checked){
    return s.value;
    }
  else{
    return 0;
    }
  };

function setSelect(frm, fld, val){
  s = eval("document.forms."+frm+"."+fld+".options")
  for (var i=0; i< s.length; i++){
    if (s[i].value == val) s.selectedIndex = i;
    }
  };

function setCheck(frm, fld, val){
  s = eval("document.forms."+frm+"."+fld)
  if (s.value == val){
    s.checked = true;
    }
  else{
    s.checked = false;
    }
  };

function setRadio(frm, fld, val){
	if (val=='true') val = "1";
	if (val=='false') val = "0";
	s = eval("document.forms."+frm+"."+fld)
	for (var i=0; i< s.length; i++){
		if (s[i].value == val) s[i].checked = true;
		}
	};

function getRadio(frm, fld){
	s = eval("document.forms."+frm+"."+fld)
	for (var i=0; i< s.length; i++){
		if (s[i].checked) {
      return s[i].value;
      }
		}
	};

function in2z(inp){
  var out = new Number(0);
  if (isNaN(inp) || inp==''){
    return out;
    }
  else{
    return new Number(inp);
    }
  }

function n2n(inp){
  var out = new String("");
  inp = new String(inp);
  if (inp.toLowerCase() == 'undefined' || inp.toLowerCase() == 'null' || inp == null){
    return out;
    }
  else{
    return inp;
    }
  }

function z2n(inp){
  var out = new String("");
  inp = new String(inp);
  if (inp.toLowerCase() == 'undefined' || inp.toLowerCase() == 'null' || inp == null || inp == '0'){
    return out;
    }
  else{
    return inp;
    }
  };
  
arrGenres = new Array("Black Metal", "Doom/Death/Grind", "Industrial", "Punk/Hardcore", "Stoner", "Pop/Rock", "Sympho/Progressive", "Bluesrock", "Nu-metal", "Speed/Thrash", "Heavy Metal", "Hardrock/Glam/Arena/Melodic", "Gothic", "Anything");

function showDif(divid, pos){
  thisLayer = 'dif'+divid;
  thisImage = 'difimg'+divid;
  if (pos == 'LEFT') {
    thisLeft =  document.getElementById(thisImage).style.left + 300;
	  }
  else{
    thisLeft =  document.getElementById(thisImage).style.left +400;
	  }
//   thisLeft =  document.getElementById(thisImage).style.left;
  thisTop = document.getElementById(thisImage).style.top;
  document.getElementById(thisImage).style.left = thisLeft;
  document.getElementById(thisImage).style.top = thisTop;
  document.getElementById(thisImage).style.visibility = "visible";
  };

function hideDif(divid){
  thisLayer = 'dif'+divid;
  document.getElementById(thisImage).style.visibility = "hidden";
  };

function checkLoc(){
  var thisLoc = new String(top.document.location);
  /*
  if (!thisLoc.match(/indexx.asp/g)){
    document.write('<form method="POST" name="redirect" target="_top" action="/indexx.asp">');
    var loc = new String(document.location);
	if (loc.match(/topframe/g)){
	  loc = 'asp/rez_opener.asp';
	  }
    document.write('<input type="hidden" name="redirt" value="'+loc+'">');
    document.write('</form>'); 
    document.forms.redirect.submit();
    }
  */
  };
  
function afronden(inp, dec){
  var outp
  var inp = new Number(inp);
  if (!isNaN(dec)){
    if (dec == 0) outp = Math.round(inp*1)/1;
    if (dec == 1) outp = Math.round(inp*10)/10;
    if (dec == 2) outp = Math.round(inp*100)/100;
    if (dec == 3) outp = Math.round(inp*1000)/1000;
    }
  else{
    var inpABS = inp;
    if (inp<0) inpABS=inp*-1;
    if (inpABS>=100) outp  = Math.round(inp*1)/1;
    if (inpABS<100)  outp  = Math.round(inp*10)/10;
    if (inpABS<10)   outp  = Math.round(inp*100)/100;
    }
  return outp;  
  }

function resizepagebody(){
 if ( typeof( window.innerWidth ) == 'number' && document.getElementById("pageBody").style) 
 {
  //Non-IE
  document.getElementById("pageBody").style.height = document.body.clientHeight-65+"px"
  //alert(document.getElementById("pageBody").style.height);
  }
 }
  
