browserName = navigator.appName;          
browserVer = parseInt(navigator.appVersion);

if (browserName == "Netscape" && browserVer >= 3)
   hasImageSupport = true;
else if (browserVer > 3)
   hasImageSupport = true;
   

function FIND(item) {
  if( window.mmIsOpera ) return(document.getElementById(item));
  if (document.all) return(document.all[item]);
  if (document.getElementById) return(document.getElementById(item));
  return(false);
}

function moveXbySlicePos (x, imgname) { 
  var img = FIND(imgname) || document.images[imgname] || document.links[imgname] || document.anchors[imgname];

  if (!document.layers) {
    var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
    var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
    var par = img;
    var lastOffset = 0;
    while(par){
      if( par.leftMargin && ! onWindows ) x += parseInt(par.leftMargin);
      if( (par.offsetLeft != lastOffset) && par.offsetLeft ) x += parseInt(par.offsetLeft);
      if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft;
      par = macIE45 ? par.parentElement : par.offsetParent;
    }
  } else if (img.x) {
     x += img.x;
  }
  return x;
}

function getExplorerVersion()
{
	var ieVers = parseFloat(navigator.appVersion);
	if( navigator.appName != 'Microsoft Internet Explorer' ) return ieVers;

	var tempVers = navigator.appVersion;

	var i = tempVers.indexOf( 'MSIE ' );
	if( i >= 0 ) 
	{
		tempVers = tempVers.substring( i+5 );
		ieVers = parseFloat( tempVers ); 
	}
	return ieVers;
}


function moveYbySlicePos (y, imgname)
{
	var img = FIND(imgname) || document.images[imgname] || document.links[imgname] || document.anchors[imgname];
	if(!document.layers) 
	{
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = img;
		var lastOffset = 0;
		while(par)
		{
			if( par.topMargin && !onWindows ) y += parseInt(par.topMargin);
			if( (par.offsetTop != lastOffset) && par.offsetTop ) y += parseInt(par.offsetTop);
			if( par.offsetTop != 0 ) lastOffset = par.offsetTop;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}    
	} 
	else if (img.y >= 0) 
		y += img.y;
		
	return y;
}


function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function DoPreview (id,isOn)
{
	if (isOn)
	{

		
		
		
		var scrollPos = f_scrollTop();
		if (scrollPos)
			document.getElementById('preview_holder').style.top = (scrollPos)+'px';
		else
			document.getElementById('preview_holder').style.top = '0px';
		

		document.getElementById('preview_holder').style.display  = "block";			

		var objImage = document.createElement ("img");
		objImage.onload = function (evt) {
			document.getElementById('placeholder').src = this.src;
		}
		
		
		var source = "shop-online/big/"+id+".jpg"
		objImage.src = source;
//		document.getElementById('preview_holder').innerHTML = objImage.src;

	}
	else
	{
		document.getElementById('preview_holder').style.display  = "none";		
		document.getElementById('preview_holder_pic').innerHTML = '<img src="images/spacer.gif" width="550" height="550" alt="" id="placeholder">';		
	}
}
