function imgUpload(){
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="150" HEIGHT="50" id="imgUploadSWF">'); 
	document.write('<PARAM NAME=movie VALUE="/swf/imgupload2.swf">');
	document.write('<param name="allowScriptAccess" value="SameDomain" />');
	document.write('<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF>');
	document.write('<PARAM NAME=base value="/">');
	document.write('<EMBED base="/" src="/swf/imgupload2.swf" quality=high bgcolor=#FFFFFF WIDTH="150" HEIGHT="50" NAME="imgUploadSWF" allowScriptAccess="SameDomain" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
	document.write('</OBJECT>');
}

function album(mybase){
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="750" HEIGHT="500" id="myMovieName">'); 
	document.write('<PARAM NAME=movie VALUE="/albumflash/autoviewer.swf">');
	document.write('<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF>');
	document.write('<PARAM NAME=base value="'+mybase+'">');
	document.write('<EMBED base="'+mybase+'" src="/albumflash/autoviewer.swf" quality=high bgcolor=#FFFFFF WIDTH="750" HEIGHT="500" NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
	document.write('</OBJECT>');
}

function clear_input(label){
	elem = document.getElementById(label);
	if (elem.className.indexOf("suggest") != -1) {		// not erase when user re-types
		elem.value = "";
		elem.className = elem.className.replace("suggest", "");
		/*if (label=="nombre_novio" || label=="apellido_novio1" || label=="apellido_novio2" || label=="nombre_novia" || label=="apellido_novia1" || label=="apellido_novia2" || label=="date_event") {
			elem.className="inputsmall";
		}else elem.className="";*/
	}
}


// function sets values to null just in case user did not click
function check_filled(valor){
	var i;
	for (i=0;i<valor.length;i++) {
		if (document.getElementById(valor[i]).className.indexOf("suggest")!= -1){
			document.getElementById(valor[i]).value="";
		}
	}
}

function openWindow(web){
	if (web=="conditions") {
		window.open("conditions.php","conditions");
	}
}

function show_div(valor,div){
	elem = document.getElementById(div);
	if (valor=="yes") {
		elem.style.display ="block";
	}else{
		elem.style.display ="none";
	}
}

var codeOk = function(o){
	if (o.responseText == "ok") {
		document.getElementById("info_code").innerHTML = "<img src=\"/skins/base/accept.png\">";
	}else if (o.responseText == "noOk"){
		document.getElementById("info_code").innerHTML = "<img src=\"/skins/base/error.png\">";
	}else document.getElementById("info_code").innerHTML = "";
};

var codeNoOk = function (o){
	document.getElementById("info_code").innerHTML = "";
}

var callback = 
{
	success: codeOk,
	failure: codeNoOk,
	argument: null
}

function check_code(id){
	if (document.getElementById("code").value.length >=6) {
		var transaction = YAHOO.util.Connect.asyncRequest('GET', "/checkCode.php?code="+document.getElementById("code").value+"&r="+Math.random()+"&id="+id, callback, null);
	}else document.getElementById("info_code").innerHTML = "";
}

function add_location(day,hour,address,description,title){
	document.getElementById("tlocations").innerHTML+= "<table><tr><td width=\"70\" align=\"left\">"+day+"</td><td width=\"15\"></td><td width=\"50\" align=\"left\">"+hour+"</td><td width=\"15\"></td><td width=\"150\" align=\"left\">"+address+"</td><td width=\"15\"></td><td width=\"150\" align=\"left\">"+description+"</td><td width=\"15\"></td><td width=\"150\" align=\"left\">"+title+"</td></tr><tr><td><input class=\"inputday\" type=\"text\" name=\"dia"+loc+"\" </td><td width=\"15\"></td><td><input class=\"inputhour\" type=\"text\" name=\"hora"+loc+"\" </td><td width=\"15\"></td><td><input class=\"inputsmall\" type=\"text\" name=\"address"+loc+"\" </td><td width=\"15\"></td><td><input class=\"inputsmall\" type=\"text\" name=\"description"+loc+"\" </td><td width=\"15\"></td><td><input class=\"inputsmall\" type=\"text\" name=\"title"+loc+"\" </td></tr></table>";
	loc=loc+1;
}

function edit_switch(mydiv)
{
	var tmp = document.getElementById(mydiv+"_edit").style.display;
	document.getElementById(mydiv+"_edit").style.display = document.getElementById(mydiv+"_view").style.display;
	document.getElementById(mydiv+"_view").style.display = tmp;
}

function change_location(value){
	var a = document.getElementsByTagName("div");
	for (i=0;i<a.length;i++) {
		if (a[i].getAttribute("location")==1){
			a[i].style.display="none";
		}
	}
    document.getElementById(value).style.display='';
}

function change_menu(value){
	var a = document.getElementsByTagName("div");
	for (i=0;i<a.length;i++) {
		if (a[i].getAttribute("menu")==1){
			a[i].style.display="none";
		}
	}
    document.getElementById(value).style.display='';
}

function check_filled_error(o_input, o_div, o_form)
{
	var callform = true;
	for(var i=0;i<o_input.length;i++) 
	{
		var oi = document.getElementById(o_input[i]);
		if(oi) {
			if(oi.value == '') {
				callform = false;
				var od = document.getElementById(o_div[i]);
				if(od) {
					od.style.display='block';
				}
			}
			else
			{
				var od = document.getElementById(o_div[i]);
				if(od) {
					od.style.display='none';
				}
			}
		}
	}
	if(callform) {
		o_form.submit();
	}
	return false;
}

function check_valid_url(o_div)
{
	var value = document.getElementById(o_div).value;
	value = value.replace(/^\s+|\s+$/g,"");
	value = value.replace(/[^A-Za-z0-9&-]/g, "");
	document.getElementById(o_div).value = value;
}
