$(document).ready(function () {

    swfobject.embedSWF( "/Swf/banner_home.swf", "banner", "960", "155", "7", "", {}, {wmode:"transparent"}, {} );

	$("#btn-otras-web").click(function(){
		if( $("#listado-otras-web").val() != '' )
		{
			$("#btn-otras-web").attr('href', $("#listado-otras-web").val());
			$("#btn-otras-web").attr('target', '_blank'); 
		}
		else
		{
			$("#btn-otras-web").attr('href', 'javascript:;');
			$("#btn-otras-web").attr('target', ''); 
		}
	});
	
});

/*
function navigate( href )
{
    if ( href != "" )
    {
        window.open( href , "", "" );
    }
}
*/

function openWaiting()
{
    $("#dialog-waiting").dialog({

        modal: true,
        resizable: false,
        closeOnEscape: false,
        draggable: false,
        height: '110'

    });
}

function closeWaiting()
{ 
    $("#dialog-waiting").dialog("close");
}

function emailEnviado(reload)
{
    $("#dialog-emailenviado").dialog({

        modal: true,
        resizable: false,
        closeOnEscape: false,
        draggable: true,
        height: 150,
        width:350,
        close: function (event, ui) { $(this).dialog("destroy"); },
        buttons:
        {
            Ok: function ()
            {
                if (reload) { location.href = location.href; }
                else { $(this).dialog("close"); }
            }
        }

    });
}

function queryParam(name)
{
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    
    if (results == null) return "";
    else return results[1];
}
