var browser = jQuery.browser;

// Fix PNG images in Internet Explorer
function correctPNG() 
{
	if (browser.msie&&browser.version>=5.5) {
	 for(var i=0; i<document.images.length; i++) {
			var img = document.images[i];
			var imgName = img.src.toUpperCase();
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
				 var imgID = (img.id) ? "id='" + img.id + "' name='" + img.id + "' " : "";
				 var imgClass = (img.className) ? "class='" + img.className + "' " : "";
				 var imgTitle = (img.title) ? "title=\"" + img.title + "\" " : "title=\"" + img.alt + "\" ";
				 var imgStyle = "display:inline-block" + img.style.cssText ;
				 //var imgSizingMethod 
				 if (img.align == "left") imgStyle = "float:left;" + imgStyle;
				 if (img.align == "right") imgStyle = "float:right;" + imgStyle;
				 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;	
				 var strNewHTML = "<span " + imgID + imgClass + imgTitle
				 + " style=\"" + "width:" + (img.width == "0" ? "10" : img.width ) + "px; height:" + (img.height == "0" ? "10" : img.height ) + "px;" + imgStyle + ";"
					 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				 + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>" ;
				 //alert(strNewHTML);
				 img.outerHTML = strNewHTML;
				 i = i-1;
			 }
		 }
	 }
}
	 
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function legal_window(url) {
	var link = window.open(url,"legal",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,top=(20),left=(20),screenX=(20),screenY=(20),width=560,height=450');
}

function contact_window(url) {
	var link = window.open(url,"contact",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,top=(20),left=(20),screenX=(20),screenY=(20),width=760,height=420');
}

// Returns the source object that fired the event
function getEventSource(evt) {
	return (window.event) ? evt.srcElement : evt.target;
}

// Determine if a given node is within a parent node with the specified id
function childOf(node, parentId) {
	var p = node.parentNode;
	if (!p) return false;
	if (p && p.id == parentId) return true;
	else return childOf(p, parentId);
}
