function checkform(f, al) {
		for (var i = 0; i<f.elements.length; i++) 
		if (null!=f.elements[i].getAttribute("required")) 
			if (isEmpty(f.elements[i].value)) {
				alert(al);
				return false;
			}
}

function isEmpty(str) {
  for (var i = 0; i < str.length; i++)
     if (" " != str.charAt(i))
         return false;
     return true;
}

var modalWindow = {
	parent:"body",
	windowId:null,
	content:null,
	width:null,
	height:null,
	close:function()
	{
		$(".modal-window").remove();
		$(".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>";	

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

		$(".modal-window").append("<a class=\"close-window\"></a>");
		$(".close-window").click(function(){modalWindow.close();});
		$(".modal-overlay").click(function(){modalWindow.close();});
		$("body").keydown(function(event) {
			if (event.keyCode == '27') {
				modalWindow.close();
				return false;
			}
		});
	}
};

var openMyModal = function(source)
{
	modalWindow.windowId = "myModal";
	modalWindow.width = 380;
	modalWindow.height = 450;
	modalWindow.content = "<iframe width='380' height='450' frameborder='0' scrolling='no' allowtransparency='true' src='" + source + "'></iframe>";
	modalWindow.open();
};
