var ie4          = false;
var ie5          = false;
var ns4          = false;
var ns6          = false;
var mac          = false;
var testing      = false;

if(document.layers){origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}}else{onresize=function(){window.location.reload();}}
function Popup(title,filename, w, h, scroll, resizable){if (title == ''){ title = 'popup'; }if (scroll == 'scroll'){ scroll = 'yes'; }else{ scroll = 'no'; }if (resizable == 'lock'){ resizable = 'no'; }else{ resizable = 'yes'; }winOptions = eval("'width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable="+resizable+",copyhistory=no'");window.open(filename,title,winOptions);return;}
function safemail(name,domain,display,this_class) {displayed = (typeof(display) == "undefined") ? name+"@"+domain : display;displayed_class = (typeof(this_class) == "undefined") ? '' : ' class="'+this_class+'"';document.write('<a href=mailto:'+name+'@'+domain+displayed_class+'>'+displayed+'</a>');}
function SetFocus(fieldname,formname){if (formname == ''){ formname = 'form'; }if (eval("document."+formname+".elements[fieldname].value == ''")){ eval("document."+formname+".elements[fieldname].focus();"); }}
function SetElementPosition(id,top,left) {
  if (testing) { alert("SetElementPosition\nid = "+id+"\ntop = "+top+"\nleft = "+left); }
  if (ns4) {
    eval('document.'+id).top = top;
    eval('document.'+id).left = left;
  } else if (ns6) {
    document.getElementById(id).style.top = top;
    document.getElementById(id).style.left = left;
  } else {
    eval(id).style.top  = top;
    eval(id).style.left = left;
  }
}
function getImageTop(imgID) {
  if (ns4) return eval(imgID).y;
  else return getRealTop(imgID);
}
function getImageLeft(imgID) {
  if (ns4) return eval(imgID).x
  else return getRealLeft(imgID);
}
function getRealTop(imgElem) {
  yPos = eval(imgElem).offsetTop;
  tempEl = eval(imgElem).offsetParent;
  while (tempEl != null) {
    yPos += tempEl.offsetTop;
    tempEl = tempEl.offsetParent;
  }
  return yPos;
}
function getRealLeft(imgObj) {
	xPos = eval(imgObj).offsetLeft;
	tempObj = eval(imgObj).offsetParent;
  while (tempObj != null){
    xPos   += tempObj.offsetLeft;
    tempObj = tempObj.offsetParent;
  }
	return xPos;
}
//////////////////////////////////////////
//////////////////////////////////////////
function Init() {
  SetBrowser();
  PositionLogin();
}
function SetBrowser() {
  agent = navigator.userAgent.toLowerCase();
  mac   = (agent.indexOf("mac")!=-1);
  ie4   = (document.all && !document.getElementById) ? true : false;
  ie5   = (document.all && document.getElementById)  ? true : false;
  ns4   = (document.layers)                          ? true : false;
  ns6   = (document.getElementById && !document.all) ? true : false;
  if (testing){ alert("agent: "+agent+"\nmac: "+mac+"\nie4: "+ie4+"\nie5: "+ie5+"\nns4: "+ns4+"\nns6: "+ns6+"\n"); }
}
function PositionLogin() {
  // get anchor image
  anchorObj = document.getElementById("anchor1");
  
  // set position
  logint   = getImageTop(anchorObj)  + 79;
  loginl   = getImageLeft(anchorObj) + 195;
  shopnowt = getImageTop(anchorObj)  + 46;
  shopnowl = getImageLeft(anchorObj) + 195;
  SetElementPosition('login', logint, loginl);
  SetElementPosition('shopnow', shopnowt, shopnowl);
  
  // show
  document.getElementById("login").style.display = 'block';
  document.getElementById("shopnow").style.display = 'block';
}