﻿
// Funcion para onmaouse over de las imagenes
function Rollover(theImage, theSrc) {
    var objStr, obj;
    if (document.images) {
        if (typeof (theImage) == 'string') {
            objStr = 'document.' + theImage;
            obj = eval(objStr);
            obj.src = theSrc;
        }
        else if ((typeof (theImage) == 'object') && theImage && theImage.src) {
            theImage.src = theSrc;
        }
    }
}

function SetMenuDefault(idSection) {
    switch (idSection) {
        case "1":
            document.QA.src = "/Images/buttons/menu_agenda_on.gif";
            break;
        case "2":
            document.QM.src = "/Images/buttons/menu_music_on.gif";
            break;
        case "3":
            document.QAC.src = "/Images/buttons/menu_artcult_on.gif";
            break;
        case "4":
            document.QA.src = "/Images/buttons/menu_agenda_on.gif";
            break;
        case "5":
            document.QBG.src = "/Images/buttons/menu_blog_on.gif";
            break;                        
        default:
            break;
    }
}

function LoadMap(longitude, latitude, containerId) {
        document.getElementById(containerId).src = "/mapa.aspx?long=" + longitude + "&lat=" + latitude;
    }

// open a popup window
function openwin(url, w, h, s) {
    var scrl;
    if (s) { scrl = "scrollbars=yes,"; w = w + 16; }
    else { scrl = "scrollbars=no,"; }

    if (!w) w = 640;
    if (!h) h = 480;

    fenster = window.open(url, "_blank", scrl + "resizable=yes,width=" + w + ",height=" + h + ",screenX=50,screenY=50");
    fenster.focus();
   }

   //** Show category
   var temp_cat = "category_1";
   function ShowReviewByCat(cat) {

   	$("#" + temp_cat).fadeOut("fast",
   	    function() {
   	$("#" + cat).fadeIn("fast");
   	    }
   	);

   	    $("#item_" + temp_cat).parent().attr("style", "background:none");
   	    $("#item_" + cat).parent().attr("style", "background:white");
   	temp_cat = cat  	

   }
   
function ClearField(fieldId, default_value)
{

    if(document.getElementById(fieldId)!=null && document.getElementById(fieldId).value==default_value)
    {            
            document.getElementById(fieldId).value = '';
    }
}



// Funcion que retornal si el campo es nulo
function isEmpty(e) {
    if ((e.value == null) || (e.value == ""))
        return true;
}
// Funcion que valida un campo de texto
function textOk(text) {
    if (isEmpty(text)) {
        //ShowMsgEmpty(msg);
        //text.focus();
        //text.select();
        return false;
    }
    return true;
}
function mailOk(text, msg) {
    var str = text.value;
    result = ((str.indexOf('@') != -1) && (str.indexOf('@') != 0) && (str.indexOf('@') != str.length - 1) && (str.indexOf('.') != -1) && (str.indexOf('.') != 0) && (str.indexOf('.') != str.length - 1))
    if (!result)
    //alert(msg);
        text.focus();
    text.select();
    return result
}

function SwapBack(id) {
    $("#" + id).toggleClass("item_image_over");
}


