var basePath = '';

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function trim(str){
	return str.replace(/^\s+|\s+$/g,"");
}

function reloadCode(timeC, imagePlacer) {
	theObj = MM_findObj(imagePlacer);
	theObj.src=basePath + 'contactImg.php?k=' + timeC + theObj.name;
}

function newCode(imagePlacer) {
	timeC = Math.random();
	theObj = MM_findObj(imagePlacer);
	theObj.src=basePath + 'contactImg.php?forceNew=yes&k=' + timeC + theObj.name;
}

function generatePWD() {
	window.open(basePath + 'auth/gen-pwd?head=clear', 'newpwd', 'width=300,height=250,scrollbars=no');
}

function checkme(opID, value) {
	el = MM_findObj(opID);
	for(i = 0; i < el.options.length; i++) {
		if (el.options[i].text == value) {
			el.selectedIndex = i;
		}
	}
}

function tabMe(lnk) {
	d = MM_findObj('divprf');
	d.style.display = 'none';
	d = MM_findObj('divpwd');
	d.style.display = 'none';
	d = MM_findObj('divmag');
	d.style.display = 'none';
	
	d = MM_findObj(lnk.rel);
	d.style.display = 'block';
	
	return false;
}

$(function(){
	// Datepickers
	$('#date_birth').datepicker({changeMonth: true,changeYear: true,yearRange: '-100:0'});
});
