function FoldOutShowHide(ElementName,ImgPath)
{
     if(document.getElementById(ElementName).style.display == "none")
     {
          document.getElementById(ElementName).style.display = "block";
          var ImageName = "hide" + ElementName;
          document.getElementById(ImageName).src = ImgPath+"FoldOutMinus.png";
     }
     else
     {
          document.getElementById(ElementName).style.display = "none";
          var ImageName = "hide" + ElementName;
          document.getElementById(ImageName).src = ImgPath+"FoldOutPlus.png";
     }
     return false;
}
function setLinks(){
  var colSpans = document.getElementsByTagName("SPAN");
  for (var i = 0; i < colSpans.length; i++){
    if(colSpans[i].className.search("Link") != -1){
      colSpans[i].onmouseover = function(){eval ("this.className = this.className+'Over';");};
      colSpans[i].onmouseout  = function(){eval ("this.className = this.className.replace(/Over/i,'');");};
    }
  }
}
function Popup(Image, Number){
  window.open("modules/show_image.php?Image="+Image, Number, "width=75,height=75,status=no,toolbar=no,menubar=no,location=no");
}
function showInstallment(Price, WindowId, Currency_Symbol){
  window.open("modules/blockCalculateInstallment.php?WindowId="+WindowId+"&Price="+Price+"&Currency_Symbol="+Currency_Symbol, WindowId, "width=350,height=400,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no");
}
function showImages(ProductId,ImgId){
  window.open("modules/popupShowImages.php?Product_Id="+ProductId+"&Img_Id="+ImgId, ProductId, "width=75,height=75,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no");
}

function setPointer(theRow, thePointerColor, theNormalBgColor)
{
    var theCells = null;

    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    var currentColor = null;
    var newColor     = null;
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', newColor, 0);
        } // end for
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor = newColor;
        }
    }

    return true;
} // end of the 'setPointer()' function

function setClass(theRow, thePointerClass, theNormalClass)
{
    var theCells = null;

    if (thePointerClass == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    var currentStyle = null;
    var newStyle     = null;
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentStyle = theCells[0].className;
        newStyle     = (currentStyle == thePointerClass)
                     ? theNormalClass
                     : thePointerClass;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].className = newStyle;//setAttribute('bgcolor', newStyle, 0);
        } // end for
    }
    else {
        currentStyle = theCells[0].className;
        newStyle     = (currentStyle == thePointerClass)
                     ? theNormalClass
                     : thePointerClass;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].className = newStyle;
        }
    }
    return true;
} // end of the 'setClass()' function

function ShowHide(ElementName)
{
     if(document.getElementById(ElementName).style.display == "none")
     {
          document.getElementById(ElementName).style.display = "block";
          var ImageName = "hide" + ElementName;
          document.getElementById(ImageName).src = "images/minus.png";
     }
     else
     {
          document.getElementById(ElementName).style.display = "none";
          var ImageName = "hide" + ElementName;
          document.getElementById(ImageName).src = "images/plus.png";
     }
     return false;
}
function ShowProductImage(Img, Source, Product_Id)
{
    if (document.getElementById(Img).src != Source)
    {
        document.getElementById(Img).src = Source;
        if(Product_Id > 0){ Hit(Product_Id);}
    }
}
function Hit(Id_Num)
{ 
     document.getElementById('SaveHit').src = "modules/blockSaveHit.php?Product_Id="+Id_Num;
}
function layer(id){
	var res
	if(document.getElementById) res=document.getElementById(id)
	//if(document.all) res=document.all[id]
	if (res) return res.style
	return null
}
var nsx;
var nsy;
if (!document.all) {
	document.captureEvents(Event.MOUSEMOVE);	
	document.onmousemove=get_mouse;
}
function get_mouse(e) {
	nsx=e.pageX-10;
	nsy=e.pageY+5;
}
function t_i(id) {
	var hlp=layer('Tp'+id);
	if (hlp) {
    	if (document.all) {
	        nsy=event.y+document.body.scrollTop;
	        nsx=event.x+document.body.scrollLeft;
    	}
	hlp.top=nsy+20;
	hlp.left=nsx-180;//(nsx>610?nsx-470:140)		
	hlp.visibility='visible';
    }
}
function t_o(id) {
	var hlp=layer('Tp'+id);
	if(hlp) hlp.visibility='hidden'
}
function OpenClose(ElementName)
{
     if(document.getElementById(ElementName).style.display == "none")
     {
          document.getElementById(ElementName).style.display = "block";
     }
     else
     {
          document.getElementById(ElementName).style.display = "none";
     }
     return false;
}
function cURL(URL){
  window.location=URL;
}

function switchOn(tab,contents) {
  switchAllOff();
  document.getElementById(tab).className = 'SelectedTab';
  document.getElementById(contents).className = 'SelectedContents';
}

function clearTop() {
  topRow = document.getElementById('TopRow');
  tabArray = topRow.childNodes;
  for (var i=0; i<tabArray.length; i++) { if (tabArray[i].className != 'TabSpacer'){ tabArray[i].className = 'Tab';} }
}

function clearContents() {
  contentsCell = document.getElementById('ContentsCell');
  contentsArray = contentsCell.childNodes;
  for (var j=0; j<contentsArray.length; j++) { contentsArray[j].className = 'Contents';}
}

function switchAllOff() { clearTop(); clearContents();}

