function changeImage(a) {
	b = document.getElementById(a).src
	if (b.indexOf('_r') > 1) {
		document.getElementById(a).src = root+'/images/nav_images/' + a + '_o.gif'
	} else {
		document.getElementById(a).src = root+'/images/nav_images/' + a + '_r.gif'
	}
}

function changeSubImage(a) {
	b = document.getElementById(a).src
	if (b.indexOf('_r') > 1) {
		document.getElementById(a).src = eval(a+'.src')

	} else {
	//	document.getElementById(a).src = root+'/images/nav_images/' + a + '_r.gif'
		document.getElementById(a).src =  eval(a+'_r.src')

	}
}


function changeStateImage(a) {
	b = document.getElementById(a).src
	if (b.indexOf('_r') > 1) {
		document.getElementById(a).src = eval(a+'.src')

	} else {
	//	document.getElementById(a).src = root+'/images/nav_images/' + a + '_r.gif'
		document.getElementById(a).src =  eval(a+'_r.src')
	}
}
function changeButton(a, b){ 


		if (document.getElementById(a).className=='button_link_'+b+'_over') {
			document.getElementById(a).className='button_link_'+b;
		} else {
			document.getElementById(a).className='button_link_'+b+'_over';
		}
	
}

function changeColor(a){

	b = document.getElementById(a.id).className
	c = b+'_focus'
	document.getElementById(a.id).className=c

}
function changeBack(a){

	b = document.getElementById(a.id).className
	c = b.substring(0, b.length-6)
	document.getElementById(a.id).className=c
}

function move_box() {
/**/
	a = document.getElementById('coverLayer').className
	if (a == 'showPopup') {
		b = document.getElementById('coverLayer').style.top
		c = parseInt(b)+20

		var ScrollTop = document.body.scrollTop;
		if (ScrollTop == 0) {
			if (window.pageYOffset)
				ScrollTop = window.pageYOffset;
			else
				ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
		}
		//coverLayer2.scrollTop = 0;
		//alert(ScrollTop)
		document.getElementById('coverLayer').style.top = 	ScrollTop+20+'px'
	}
}

function showPopProduct(popup_width, popup_height, productID, categoryID) {

		thisWidth = document.body.clientWidth
		thisHeight = document.body.clientHeight
		thisBrowser= "ie"


	var ScrollTop = document.body.scrollTop;
	if (ScrollTop == 0) {
		if (window.pageYOffset)
			ScrollTop = window.pageYOffset;
		else
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}
	ScrollTop = ScrollTop-80

	thisX = getXY(document.getElementById('product_hold_'+categoryID+'_'+productID))

	document.getElementById('coverLayer').style.left=(thisWidth-popup_width)/2+'px'
	document.getElementById('coverLayer').style.top=100+ScrollTop

	document.getElementById('coverFrame').style.width=popup_width+20+'px'
	document.getElementById('coverFrame').style.height=popup_height+'px'
	document.getElementById('coverLayer').className='showPopup'
	document.getElementById('coverLayer2').style.display='inline'

	document.getElementById('coverLayer2').style.width=thisWidth+20+'px'
	document.getElementById('coverLayer2').style.height=thisHeight+20+'px'
	
	
	
}


function showPop(popup_width, popup_height) {

	thisWidth = document.body.clientWidth
	thisHeight = document.body.clientHeight
	thisBrowser= "ie"

	var ScrollTop = document.body.scrollTop;
	if (ScrollTop == 0) {
		if (window.pageYOffset)
			ScrollTop = window.pageYOffset;
		else
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}
	ScrollTop = ScrollTop-80

	//thisX = getXY(document.getElementById('product_hold_'+categoryID+'_'+productID))

	document.getElementById('coverLayer').style.left=(thisWidth-popup_width)/2+'px'
	document.getElementById('coverLayer').style.top=100+ScrollTop

	document.getElementById('coverFrame').style.width=popup_width+20+'px'
	document.getElementById('coverFrame').style.height=popup_height+'px'
	document.getElementById('coverLayer').className='showPopup'
	document.getElementById('coverLayer2').style.display='inline'

	document.getElementById('coverLayer2').style.width=thisWidth+20+'px'
	document.getElementById('coverLayer2').style.height=thisHeight+20+'px'
	
	
	
}
function getXY(obj)
{
  var curleft = 0;
  var curtop = obj.offsetHeight + 5;
  var border;
  if (obj.offsetParent)
  {
    do
    {
      // XXX: If the element is position: relative we have to add borderWidth
      if (getStyle(obj, 'position') == 'relative')
      {
        if (border = _pub.getStyle(obj, 'border-top-width')) curtop += parseInt(border);
        if (border = _pub.getStyle(obj, 'border-left-width')) curleft += parseInt(border);
      }
      curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    }
    while (obj = obj.offsetParent)
  }
  else if (obj.x)
  {
    curleft += obj.x;
    curtop += obj.y;
  }
//  return {'x': curleft, 'y': curtop};
  return curtop;
}
/**
 * Returns the specified computed style on an object.
 * @param {HTMLObject} obj HTML Object
 * @param {String} styleProp Property name.
 * @return {Mixed} Computed style on object.
 */
function getStyle(obj, styleProp)
{
  if (obj.currentStyle)
    return obj.currentStyle[styleProp];
  else if (window.getComputedStyle)
    return document.defaultView.getComputedStyle(obj,null).getPropertyValue(styleProp);
}
function showPopFull(popup_width, popup_height) {

	if (navigator.userAgent.indexOf("MSIE") > 0) {
		thisWidth = document.body.clientWidth
		thisHeight = document.body.clientHeight
		thisBrowser= "ie"
	} else {                                                
		thisWidth = window.innerWidth
		thisHeight = window.innerHeight
		thisBrowser= "not_ie"
	}


	
	// LEFT SHOULD BE 350
	document.getElementById('left_spacer').style.width=350
	// RIGHT SHOULD BE WIDTH OF SCREEN - 350 - POPWIDTH
	document.getElementById('right_spacer').style.width=(thisWidth-popup_width)-370
	
		
	// LEFT SHOULD BE 215
	document.getElementById('left_spacer').style.height=215
	// RIGHT SHOULD BE HEIGHT OF SCREEN - 215 - POPHEIGHT
	document.getElementById('bottom_spacer').style.height=(thisHeight-popup_height)-113

//	alert(popup_height)

	document.getElementById('coverFrame').style.width=popup_width+20
	document.getElementById('coverFrame').style.height=popup_height
	document.getElementById('coverLayer').className='showSearch'
}
function showPopReciept(popup_width, popup_height) {

	if (navigator.userAgent.indexOf("MSIE") > 0) {
		thisWidth = document.body.clientWidth
		thisHeight = document.body.clientHeight
		thisBrowser= "ie"
	} else {                                                
		thisWidth = window.innerWidth
		thisHeight = window.innerHeight
		thisBrowser= "not_ie"
	}


	
	// LEFT SHOULD BE 350
	document.getElementById('left_spacer').style.width=160
	// RIGHT SHOULD BE WIDTH OF SCREEN - 350 - POPWIDTH
	document.getElementById('right_spacer').style.width=(thisWidth-popup_width)-180
	
		
	// LEFT SHOULD BE 215
	document.getElementById('left_spacer').style.height=100
	// RIGHT SHOULD BE HEIGHT OF SCREEN - 215 - POPHEIGHT
	document.getElementById('bottom_spacer').style.height=(thisHeight-popup_height)-100

//	alert(popup_height)

	document.getElementById('coverFrame').style.width=popup_width+20
	document.getElementById('coverFrame').style.height=popup_height
	document.getElementById('coverLayer').className='showSearch'
}

function getwindowsize() {
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		thisWidth = document.body.clientWidth
		thisHeight = document.body.clientHeight
		thisBrowser= "ie"
		thisHeight = eval(thisHeight-164)
	} else if (navigator.userAgent.indexOf("Saf") > 0) {   
		thisWidth = window.innerWidth
		thisHeight = window.innerHeight
		thisBrowser= "saf"
		thisHeight = eval(thisHeight-160)
	} else {      
		thisWidth = window.innerWidth
		thisHeight = window.innerHeight
		thisBrowser= "not_ie"
		thisHeight = eval(thisHeight-164)
	}
	
	thisH = eval(thisHeight-77-87)
//	alert(navigator.userAgent)
	//alert(thisBrowser)
	document.getElementById('growMe').style.height=thisHeight
	document.getElementById('footer_td').style.visibility='visible'
	document.getElementById('footer_td').style.display='inline'


}


function search_page() {
	a = document.search_form.SearchField.value
	if (a != '') {
		document.search_form.submit()
	}

}
/*

netscape = "";
ver = navigator.appVersion; len = ver.length;
for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break;
netscape = (ver.charAt(iln+1).toUpperCase() != "C");



	if (navigator.userAgent.indexOf("MSIE") > 0) {
		thisWidth = document.body.clientWidth
		thisHeight = document.body.clientHeight
		thisBrowser= "ie"
	} else {                                                
		thisWidth = window.innerWidth
		thisHeight = window.innerHeight
		thisBrowser= "not_ie"
	}
//	alert(thisBrowser)
*/
