function open_modal(url, width, height){
    splits = url.split('?');
    args = "";
    if (splits.length > 1){args = splits[1];}
    pop_url = splits[0]+"?pop=1&amp;"+args;
    $("#modal-from-dom .modal-body").html("<iframe scrolling='no' src='"+pop_url+"' style='width:"+width+";height:"+height+";' frameborder=0></iframe>");
    $("#modal-from-dom").modal({show: true, backdrop: true});
}

$(document).ready(function() {
    $('.tooltip').twipsy({html: true});
    $('a[rel="popover"]').popover({html: true});
    $('a[rel="popover-below"]').popover({placement: 'below', html: true});
    
	$('.open-modal').click(function(){
	    open_modal($(this).attr('href'), "100%", "200px");
        return false;
	});
	$('.open-modal-big').click(function(){
	    open_modal($(this).attr('href'), "100%", "480px");
        return false;
	});
    
    $('.gps').change(function(){
        url=$(this).val();
        option = $(this).find('option:selected');
        if(url != ""){
            if (option.hasClass('open-modal')) {
        	    open_modal(url, "100%", "200px");
            }else if(option.hasClass('open-modal-big')){
                open_modal(url, "100%", "480px");
            }else{
                location.href=url;
            };
            
            
        }
    });
    
});

