﻿function showDialog(id, title) {
	var d = jQuery("#" + id);
	if (title != undefined && title != "") {
		d.dialog('option', 'title', title);
	}


	d.dialog("open");
}
function closeDialog(id) {
	jQuery("#" + id).dialog("close");
}
function select_tab_easymenu(objProperties) {
    // hide all children of parentDiv
    var _tabs = jQuery('#' + objProperties.parentDiv + ' > *').hide();

    // Show active tab

    jQuery(_tabs[objProperties.index]).show();


    // activate selected (easy) menu
    ob_em_SelectItem(objProperties.menuId);

    // eventhandler
    if (objProperties.onchange) {
        objProperties.onchange(objProperties.index, objProperties.menuId);
    }

}
/*
function select_tab_easymenu(index, parentDiv, menuId) {

    // hide all children of parentDiv
    var _tabs = jQuery('#' + parentDiv + ' > *').hide();

    // Show active tab
    
        jQuery(_tabs[index]).show();
    

    // activate selected (easy) menu
    ob_em_SelectItem(menuId);
}
*/
function getAnchor() {
    var myFile = document.location.toString();
    if (myFile.match('#')) { // the URL contains an anchor
        return myFile.split('#')[1];
    }
    return null;
}

function stopEventPropagation(e) {
    if (!e) { e = window.event; }
    if (!e) { return false; }
    e.cancelBubble = true;
    if (e.stopPropagation) { e.stopPropagation(); }
   }
   var prevPopup = null;
   Sys.Application.add_load(function() {

   	jQuery("a.popup").click(function(event) {
   		var thisLink = jQuery(this);
   		if (prevPopup != null) prevPopup.close();
   		prevPopup = window.open(thisLink.attr("href"), thisLink.attr("name"), "menubar=no,width=300,height=300,toolbar=no");
   		prevPopup.focus();
   		event.preventDefault();
   	});
   	//    jQuery(function() {
   	//        if (jQuery.browser.msie) {
   	//            jQuery('input:radio, input:checkbox').click(function() {
   	//                this.blur();
   	//                this.focus();
   	//            });
   	//        }
   	//    });
   	/*
   	jQuery("form").validate({
   	messages: { email: { required: "*", email: "Please enter a valid email address"} }
   	});*/
   });
