/*
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
   {
   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 + "' " : ""
		 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 imgAttribs = img.attributes;
		 for (var j=0; j<imgAttribs.length; j++)
			{
			var imgAttrib = imgAttribs[j];
			if (imgAttrib.nodeName == "align")
			   {
			   if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle
			   if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle
			   break
			   }
            }
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 strNewHTML += " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 strNewHTML += "(src=\'" + img.src + "\', sizingMethod='');\"></span>"
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
   }
if (window.attachEvent)
{
window.attachEvent("onload", correctPNG);
}   
*/

function popUp(id,clientID,Features) {

Features = 'menubar=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,resizable=no';

  var winl = (screen.width-720)/2;
  var wint = (screen.height-375)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + 375 + ',';
  settings += 'width=' + 720 + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += Features;
  win = window.open('http://www.merchlackey.com/popUp.php?productID=' +  id+'&clientID='+clientID,id,settings);
  win.window.focus();

}

function popUpSnoCap(id) {

Features = 'menubar=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,resizable=no';
  id = id.toString();

  var winl = (screen.width-425)/2;
  var wint = (screen.height-300)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + 300 + ',';
  settings += 'width=' + 425 + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += Features;
  win = window.open('../popUpSnoCap.php?image=' +  id,'MP3S',settings);
  win.window.focus();

}

function popUpMp3(id,url) {

Features = 'menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,resizable=no';
  id = id.toString();

  var winl = (screen.width-720)/2;
  var wint = (screen.height-375)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + 375 + ',';
  settings += 'width=' + 720 + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += Features;
  win = window.open('../downloads/index.php?productID=' +  id+'url=' +  url,'MP3S',settings);
  win.window.focus();

}

function setWin(newLoc, newWidth, newHeight) {
        newWin = open("",newLoc,"scrollbars=yes,resizable=no,status=no,height=" + newHeight + ",width=" + newWidth);
}
function popUpSizer(url, newWidth, newHeight) {
  Features = 'menubar=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,resizable=no';
  var winl = (screen.width-newWidth)/2;
  var wint = (screen.height-newHeight)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + newHeight + ',';
  settings += 'width=' + newWidth + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += Features;
  win = window.open(url,'MP3',settings);
  win.window.focus();

}

function popUpSizer(url, newWidth, newHeight) {
  Features = 'menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,resizable=no';
  var winl = (screen.width-newWidth)/2;
  var wint = (screen.height-newHeight)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + newHeight + ',';
  settings += 'width=' + newWidth + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += Features;
  win = window.open(url,'FOOBAR',settings);
  win.window.focus();

}

function popUpTonyHawk(PageLink,myWidth,myHeight) {
//var myWidth = myWidth;
//var myHeight = myHeight;
//PageLink = PageLink.toString();

Features = 'menubar=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,resizable=yes';
  var winl = (screen.width-myWidth)/2;
  var wint = (screen.height-myHeight)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + myHeight + ',';
  settings += 'width=' + myWidth + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += Features;
  win = window.open(PageLink,'ML',settings);
  win.window.focus();

//alert(myHeight);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/*
	tableruler()
	written by Chris Heilmann for alistapart.
	enables a rollover of rows for each table with the classname "hlrows"
*/

function tableruler()
{
	if (document.getElementById && document.createTextNode)
	{
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++)
		{
			if(tables[i].className=='ruler')
			{
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++)
				{

						trs[j].onmouseover=function(){this.className='ruled';return false}
						trs[j].onmouseout=function(){this.className='';return false}

				}
			}
		}
	}
}
//DROPLISST SCRIPT
//
var currentElement = '';

function showElement(id) {

	var iReturnValue = 0;
	elementid=document.getElementById('why')
	while( elementid != null ){
	iReturnValue += elementid.offsetTop;
	elementid = elementid.offsetParent;
	}
	
	var element = document.getElementById(id);
	if (element) {
		element.style.display = ((element.style.display == 'none')
								 ? 'block'
								 : 'none');
		if(id == 'show_current_products')
		{ 
			element.style.top = (iReturnValue+180);
		}
		else if(id == 'comments')
		{ 
			element.style.top = (iReturnValue+200);
		}							 
	}
}

function showElementFull(id) {
	var element = document.getElementById(id);
	if (element) {
		element.style.display = ((element.style.display == 'none')
								 ? 'block'
								 : 'none');
	}

	var current = document.getElementById(currentElement);
	if (current && (currentElement != id)) {
		current.style.display = 'none';
	}

	currentElement = id;
}

function showElementFist(orig,id) {
	if(orig != 'submenu_')
	{
		//alert("here");
		var narp = document.getElementById(orig);
		narp.style.display = 'none';
	}
	var element = document.getElementById(id);
	if (element) {
		element.style.display = ((element.style.display == 'none')
								 ? 'block'
								 : 'none');
	}

	var current = document.getElementById(currentElement);
	if (current && (currentElement != id)) {
		current.style.display = 'none';
	}

	currentElement = id;
}