﻿//This function is being used as the A tag URL, 
//to include the CMC regExp indentification - when redirection is not relevant
function ignore(cmc_param) {}
//This function is being used as the A tag URL, 
//to include the CMC regExp indentification - when redirection is relevent
function loadURL (url, cmc_param, newWindow)
{
  if (newWindow)
    window.open(url, "_blank"); 
  else
    window.location.href = url;
}

function jsPopup(linkObj, popupQuery, offset)
{
    jsPopupClose('.popup');
    if (offset == undefined)
    {
        var width = parseInt(jQuery(popupQuery).width());
        var offset = {top:18,left:-(width/2)};
    }
    var pos = jQuery(linkObj).position();
    var overlay = jQuery("<div id='jsPopupOverlay' style='position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;'></div>");
    overlay.click(function() { jsPopupClose(popupQuery); });
    var popup = jQuery(popupQuery);
    popup.append("<div class='jsPopupClose' style='text-align:center;width:100%'><a href='#' onclick=\"jsPopupClose('" + popupQuery + "');\">[Close]</a></div>");
	popup.css({position:'absolute',top:pos.top+offset.top,left:pos.left+offset.left,padding:'10px'});
	popup.css('z-index', '1000');
	overlay.appendTo('body');
	popup.fadeIn();    
}

function jsPopupClose(popupQuery)
{
    jQuery(popupQuery).fadeOut();
    jQuery('#jsPopupOverlay').remove();
    jQuery('.jsPopupClose').remove();
}