var $j = jQuery.noConflict();

var modalWindow = {
	parent:"body",
	windowId:null,
	content:null,
	width:null,
	height:null,
	close:function()
	{
		$j(".modal-window").remove();
		$j(".modal-overlay").remove();
	},
	open:function()
	{
		var modal = "";
		modal += "<div class=\"modal-overlay\"></div>";
		modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"width:" + this.width + "px; height:" + this.height + "px; margin-top:-" + (this.height / 2) + "px; margin-left:-" + (this.width / 2) + "px;\">";
		modal += this.content;
		modal += "</div>";
        
        if(UserAgent.browser == 'ie' && UserAgent.verision == '6'){

            //var winH = $j(window).height();  
            //var winW = $j(window).width();
            //alert(winW);
                
            //Set the popup window to center  
            //$j(".modal-window").css('top',  winH/2-this.height/2);  
            //$j(".modal-window").css('left', winW/2-$(this.windowId).width()/2);  
        }

		$j(this.parent).append(modal);

		$j(".modal-window").append("<a class=\"close-window\"></a>");
		$j(".close-window").click(function(){modalWindow.close();});
	}
};

var openMyModal = function(source, width, height)
{

  modalWindow.windowId = "myModal";
	modalWindow.width = width;
	modalWindow.height = height;
	modalWindow.content = "<iframe width='"+ width +"' height='"+ height +"' id='modframe' frameborder='0' scrolling='no' allowtransparency='true' src='" + source + "'></iframe>";
	modalWindow.open();
};

