/*js for profile.php*/
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

addLoadEvent(function() {
m_show();
		})

function toggleDiv(id,flagit) {
	if (flagit=="1"){
		if (document.layers) 
			document.layers[''+id+''].visibility = "show"
		else if (document.all) 
			document.all[''+id+''].style.visibility = "visible"
		else if (document.getElementById) 
			document.getElementById(''+id+'').style.visibility = "visible"
	}
	else
		if (flagit=="0"){
			if (document.layers) 
				document.layers[''+id+''].visibility = "hide"
			else if (document.all) 
				document.all[''+id+''].style.visibility = "hidden"
			else if   (document.getElementById) 
				document.getElementById(''+id+'').style.visibility = "hidden"
		}
}

function m_show(){
	toggleDiv('oferta',1)    
}
function m_hide(){
	toggleDiv('oferta',0)    
}

function validate_form2 (){
	valid = true;
	if ( document.form2.emails.value == "" )   {
		alert ( "Please fill the box with your friends email." );
		valid = false;
	}
	return valid;
}

function validate_form (){
	valid = true;
	if ( document.form1.emails.value == "" )   {
		alert ( "Please fill the box with your friends email." );
		valid = false;
	}
	else if ( document.form1.paypal.value == "" )   {
		alert ( "Please fill Paypal box with your Paypal email." );
		valid = false;
	}
	else {
		value=document.form1.paypal.value;
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert ( "Please provide a valid Paypal email." );
			valid=false;
		}
	}


	return valid;
}


