function showImage(img_src, img_width, img_height) {
	
   	var imgdiv = xGetElementById('imageFrame');
   	
   	var winCon = "<div class='imageSingle'>";
	winCon += "<div style='text-align: center; font-size: small; margin-bottom: 5px;'>[ <a style='color: white;' href='javascript:hideImage()'>Close Window<\/a> ]<\/div>";
	winCon += "<img src='" + img_src + "'";
	if (img_width) {
		winCon += " width='" + img_width + "'";
	}
	if (img_height) {
		winCon += " height='" + img_height + "'";
	}
	winCon += " alt='image loading'/>";
	winCon += "<\/div>";
		
	imgdiv.innerHTML = winCon;
	xMoveTo(imgdiv, 40, xScrollTop()+20);
	xShow(imgdiv);
	
   	var IfrRef = xGetElementById('Shim');
   	IfrRef.style.width 	= imgdiv.offsetWidth;
	IfrRef.style.height 	= imgdiv.offsetHeight;
	xMoveTo(IfrRef, 40, xScrollTop()+20);
	IfrRef.style.display 	= "block";

}
function hideImage() {
	var IfrRef = document.getElementById('Shim');
   	IfrRef.style.display 	= "none";
   	
	h = xGetElementById('imageFrame');
	xHide(h);
}

function changeProductImg(prodId,attId,Desc,has_link) {
	pic1= new Image(); 
  	pic1.src = "images/products_" + prodId + "_" + attId + ".jpg";
	
	setTimeout('loadImg("' + prodId + '","' + attId + '","' + Desc + '","' + has_link + '")', 1000);
}
function loadImg(prodId,attId,Desc,has_link) {
	imgDiv = xGetElementById('main_product_image');
	var h = '';
	if (has_link == 1) {
		h = "<a href=\"javascript:showImage('/images/products_" + prodId + "_" + attId + "_lg.jpg')\">";
	}
        h += "<img src='/images/products_" + prodId + "_" + attId + ".jpg' alt='" + Desc + "' title='" + Desc + "' style='border: none;' />";
        if (has_link == 1) {
		h += "</a>";
	}
	imgDiv.innerHTML = h;
}

// xMenu5/xCollapsible Demo
var mnu = new Array();
//window.onload = function()
//{
  //mnu[0] = new xMenu5('xm5', 'xMenuLbl', 'xMenuBtn', 'xMenuLink');
  //mnu[1] = new xMenu5('xm5b', 'xMenuLbl', 'xMenuBtn', 'xMenuLink');
//}
window.onunload = function()
{
  for (var i = 1; i < mnu.length; ++i) {
    mnu[i].onUnload();
  }
}

function handleNewsletter(dd1, prezsel)
{
  var email = document.news_subscribe.email.value;
  
  Http.get({
		url: "/subscribe.php?email=" +  email,
		callback: emailReply,
		cache: Http.Cache.Get
	}, [prezsel]);
}
function emailReply(xmlreply, prezelmt)
{
  if (xmlreply.status == Http.Status.OK)
  {
   var prezresponse = xmlreply.responseText;
   var prezar = prezresponse;
   
   var adiv = xGetElementById(prezelmt);
   var bdiv = xGetElementById("newsletter_msg");
   
   adiv.style.visibility 	= 'hidden';
   adiv.style.display		= 'none';
   
   bdiv.style.visibility	= 'visible';
   bdiv.style.display		= 'block';
   bdiv.innerHTML 	= prezar;
   
  }
  else
  {
   alert("Cannot handle the Ajax call.");
  }
}
function resetNewsletter() {
	var temp1 = xGetElementById("newsletter_msg");
	temp1.style.visibility = "hidden";
	temp1.style.display	= "none";
	
	var temp2 = xGetElementById("newsletter_subscribe");
	temp2.style.display	= "block";
	temp2.style.visibility = "visible";
	
}

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function showElement(e) {
	live = xGetElementById(e);
	xShow(live);
}

function hideElement(e) {
	temp1 = xGetElementById(e);
	xHide(temp1);
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
function checkBox(object) {
  document.account_newsletter.elements[object].checked = !document.account_newsletter.elements[object].checked;
}

function gotoo(s) { 
	var index=s.selectedIndex;
	if (s.options[index].value != "0") {
		location=s.options[index].value;
	}
}

function popWindow(url,x,y,name,resize) {
    if (!x) {
		x = 500
	}
	if (!y) {
		y = 250
	}
	if (!resize) { resize = "no" }
	if (!name) { name = "Window" }
	
	var version = parseInt(navigator.appVersion)
	var w
    if (version >= 3) {
		w = window.open(url, name, "width=" + x + ",height=" + y + ",status=no,resizable=" + resize + ",menubar=no,location=no,scrollbars=yes")
	}
    w.focus()
}

function loadPressImg(pressImg) {
	imgDiv = xGetElementById('main_press_img');
	var h = "<img src='/images/Press/" + pressImg + ".jpg' alt='' title='' style='border: none;' />";
        imgDiv.innerHTML = h;
}