if (top.frames.length!=0) {
    if (window.location.href.replace)
        top.location.replace(self.location.href);
    else
        top.location.href=self.document.href;
}

function ConfirmChoice(url,msg) { 
	answer = confirm(msg)
	
	if (answer !=0) { 
		location = url 
	} 
}

function checkChange() {
	if(document.getElementById('ActionButtonChange')) {

	} else {
		document.form.submit()
	}
}

function movein(which,html){
	document.getElementById(which).innerHTML=html
}
	
function moveout(which,html){
	document.getElementById(which).innerHTML=html
}

function imgin(which,value){
	document.getElementById(which).src=value
}

function scroll_up(scroll_div) {
  var cms_content_inner = document.getElementById(scroll_div);
  cms_content_inner.style.top += 10;
}

function scroll_down(scroll_div) {
  var cms_content_inner = document.getElementById(scroll_div);
  cms_content_inner.style.top -= 10;
}

function category_preview_product(newsrc, productid, productname) {
  
  var current_product_id = document.getElementById('category_product_preview_id').innerHTML;
  
  if (current_product_id != productid) {
    
    opacityTween = new OpacityTween(document.getElementById('product_image_preview_cover'),Tween.easeIn, 0, 100, 0.3);
    opacityTween.start()
    opacityTween.onMotionFinished = function() {
      document.getElementById('product_preview').src = newsrc;
      
      document.getElementById('product_preview').setAttribute("class","unitPng");
      
      opacityTween = new OpacityTween(document.getElementById('product_image_preview_cover'),Tween.easeOut, 100, 0, 0.3);
      opacityTween.start()
    }
    document.getElementById('category_product_preview_id').innerHTML = productid;
    
    
    /*- V01
    var category_heading_flash_container = document.getElementById('category_heading_flash_container');
    category_heading_flash_container.getElementsByTagName('object')[0].setAttribute("data","/_template/flash/heading.swf?tag=" + productname);
    alert(category_heading_flash_container.getElementsByTagName('object')[0].data);
    */
    
    
    /*- V02
    var flashvars = {};
    flashvars.width = "200";
    flashvars.height = "30";
    var params = {};
    params.wmode = "transparent";
    new swfobject.embedSWF("/_template/flash/heading.swf?tag=" + productname, "category_heading_flash2", "200", "30", "9.0.0", "/_template/javascript/swfobject/express_install.swf", flashvars, params);
    */
    
    /*- V03
    document.getElementById('category_heading_flash_container').innerHTML = '';
    
    var newdiv = document.createElement('div');
    newdiv.setAttribute('id','category_heading_flash2');
    newdiv.innerHTML = '<object data="/_template/flash/heading_as3.swf?tag=' + productname + '" type="application/x-shockwave-flash" width="200" height="30"><param name="movie" value="/_template/flash/heading_as3.swf?tag=' + productname + '" /><param name="bgcolor" VALUE="#000000"></object>';
    // newdiv.innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="200" HEIGHT="30" id="myMovieName"><PARAM NAME=movie VALUE="heading.swf?tag=hello"><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#000000><EMBED href="/_template/flash/heading.swf?tag=hello" quality=high bgcolor=#000000 WIDTH="200" HEIGHT="30" NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
    document.getElementById('category_heading_flash_container').appendChild(newdiv);
    */
    
    
    document.getElementById('category_heading_flash_container').innerHTML = '<h1>' + productname + '</h1>';
    
  }
  
}

function product_preview_product(newsrc, imageid) {
  
  var current_product_id = document.getElementById('product_product_preview_id').innerHTML;
  
  if (current_product_id != imageid) {
    
    opacityTween = new OpacityTween(document.getElementById('product_image_cover'),Tween.easeIn, 0, 100, 0.3);
    opacityTween.start()
    opacityTween.onMotionFinished = function() {
      document.getElementById('main_image').src = newsrc;
      opacityTween = new OpacityTween(document.getElementById('product_image_cover'),Tween.easeOut, 100, 0, 0.3);
      opacityTween.start()
    }
    document.getElementById('product_product_preview_id').innerHTML = imageid;
  }
  
}


function init() {
  timedMsg();
  
  var imagehover = document.getElementById('product_image');
  var imagepreview = document.getElementById('image_preview');
  
  if (imagepreview != null) {
    /*
    imagehover.onmouseover = function (evt) {
      imagehover.onmousemove = function (evt) {
        var container = document.getElementById("container");
        
        var obj = document.getElementById("follower");
        obj.style.display = 'block';
        
        e_x = evt.clientX;
        e_y = evt.clientY;
        
        e_x = (e_x * 1) + 15;
        e_y = (e_y * 1) + 5;
        
        obj.style.left = e_x + 'px';
        obj.style.top = e_y + 'px';
      }
      
    }
    
    imagehover.onmouseout = function (evt) {
      
      var obj = document.getElementById("follower");
      obj.style.display = 'none';
      
    }
    */
    imagehover.onclick = function () {
      
      imagepreview.style.top = "0px";
      imagepreview.style.background = "#000";
      imagepreview.style.border = "none";
      imagepreview.style.left = "50%";
      
      tween_imagehover_width = new Tween(imagepreview.style,'width',Tween.regularEaseOut,0,100,1,'%');
      tween_imagehover_width.start();
      
      tween_imagehover_height = new Tween(imagepreview.style,'height',Tween.regularEaseOut,0,920,1,'px');
      tween_imagehover_height.start();
      
      tween_imagehover_left = new Tween(imagepreview.style,'left',Tween.regularEaseOut,0,0,1,'px');
      tween_imagehover_left.start();
      
      tween_imagehover_height.onMotionFinished = function() {
        imagepreview.style.border = "none";
        
        scroll_preview = function () {
          var i;
          while (i++) {
            
          }
          
        }
        /*
        document.getElementById("ip_t").onmouseover = function() {
          
        };
        document.getElementById("ip_tl").onmouseover = function() {
          scroll_preview('up_left');
        };
        document.getElementById("ip_tr").onmouseover = function() {
          scroll_preview('up_right');
        };
        document.getElementById("ip_b").onmouseover = function() {
          
        };
        document.getElementById("ip_bl").onmouseover = function() {
          scroll_preview('down_left');
        };
        document.getElementById("ip_br").onmouseover = function() {
          scroll_preview('down_right');
        };
        document.getElementById("ip_c").onmouseover = function() {
          
        };
        */
        
      }
    }
    
    imagepreview.onclick = function() {
      
      imagepreview.style.width = '1px'
      imagepreview.style.height = '1px';
      imagepreview.style.top = '-1200px';
      imagepreview.style.left = '0px'; 
      
    }
    /*
    imagepreview.onmouseover = function(evt) {
      var e = new Object();
      
      e.clientX = (typeof evt.clientX != "undefined") ? evt.clientX : event.x;
      e.clientY = (typeof evt.clientY != "undefined") ? evt.clientY : event.y;
      
      
    }
    */
    
  }
  
}


function scroll_category_products(direction) {
  
  var container_width = document.getElementById('category_product_container').style.width;
  container_width = container_width.replace('px','');
  container_width = container_width * 1;
  
  var inner_width = document.getElementById('category_product_container_inner').offsetWidth;
  inner_width = inner_width * 1;
  
  if (direction == 'left') {
    var scroll_ammount = -100;
  } else {
    var scroll_ammount = 100;
  }
  
  var scroll_left = document.getElementById('category_product_container_inner').style.left;
  scroll_left = scroll_left.replace('px','');
  scroll_left = scroll_left * 1;
  
  var new_left = scroll_left + scroll_ammount;
  
  if (direction == 'left') {
    if ((new_left + inner_width) > 0) {
      
      move_cat_prods = new Tween(document.getElementById('category_product_container_inner').style,'left',Tween.regularEaseOut,scroll_left,new_left,1,'px');
      move_cat_prods.start();
      
    }
  } else {
    
    if (new_left <= 0) {
      
      move_move_cat_prods = new Tween(document.getElementById('category_product_container_inner').style,'left',Tween.regularEaseOut,scroll_left,new_left,1,'px');
      move_move_cat_prods.start();
      
    }
  }
  
  
}


function scroll_product_products(direction) {
  
  var container_width = document.getElementById('category_product_container').style.width;
  container_width = container_width.replace('px','');
  container_width = container_width * 1;
  
  var inner_width = document.getElementById('category_product_container_inner').offsetWidth;
  inner_width = inner_width * 1;
  
  if (direction == 'left') {
    var scroll_ammount = -100;
  } else {
    var scroll_ammount = 100;
  }
  
  var scroll_left = document.getElementById('category_product_container_inner').style.left;
  scroll_left = scroll_left.replace('px','');
  scroll_left = scroll_left * 1;
  
  var new_left = scroll_left + scroll_ammount;
  
  if (direction == 'left') {
    if ((new_left + inner_width) > 0) {
      
      move_cat_prods = new Tween(document.getElementById('category_product_container_inner').style,'left',Tween.regularEaseOut,scroll_left,new_left,1,'px');
      move_cat_prods.start();
      
    }
  } else {
    
    if (new_left <= 0) {
      
      move_move_cat_prods = new Tween(document.getElementById('category_product_container_inner').style,'left',Tween.regularEaseOut,scroll_left,new_left,1,'px');
      move_move_cat_prods.start();
      
    }
  }
  
  
}

/*IMAGE FADING CODE */

var opacity = 100;
var thesrc;
var theImage;
var i = 3;


function changeImages() {
  
  /*
  thesrc = "/_template/flash/welcome_images/" + i + ".png";
  
  document.getElementById("home_image_fade").src = "/_template/flash/welcome_images/" + i + ".png";
  */
  
  theImage = document.getElementById("image_" + i);
  
  if (theImage.style.top == '-1000px') {
    theImage.style.top = '0px';
  }
  
  fadeIn();
  
}

//change the opacity for different browsers 
function fadeOut() {
  
  
	if (opacity > 0) {
		opacity = opacity - 10;
		
    theImage.style.opacity = (opacity / 100); 
    theImage.style.MozOpacity = (opacity / 100); 
    theImage.style.KhtmlOpacity = (opacity / 100); 
    theImage.style.filter = "alpha(opacity=" + opacity + ")";
    
    setTimeout('fadeOut()', 40);
  } else {
    if (i < 17) {
      i++;
      changeImages();
    } else {
      i = 3
      changeImages();
    }
  }
  
}

function fadeIn() {
  
	theImage.src = thesrc;

	if (opacity < 100) {
		opacity = opacity + 5;
    
    theImage.style.opacity = (opacity / 100); 
    theImage.style.MozOpacity = (opacity / 100); 
    theImage.style.KhtmlOpacity = (opacity / 100); 
    theImage.style.filter = "alpha(opacity=" + opacity + ")";
    
    setTimeout('fadeIn()', 40);
  } else {
    setTimeout('fadeOut()', 1500);
  }
}
/*END IMAGE FADING CODE*/




var theDiv;
var pos;
var mouseDown = false;
var direction;

function moveUp(scroll_div) {
	theDiv = document.getElementById(scroll_div);
	pos = theDiv.style.top;
	
	mouseDown = true;
	direction = 0;
	animate();
}

function moveDown(scroll_div) {
	theDiv = document.getElementById(scroll_div);
	pos = theDiv.style.top;
	
	mouseDown = true;
	direction = 1;
	animate();
}

function cancelScroll() {
	mouseDown = false;
}

function animate() {
	if (mouseDown) {
    
		if (direction == 1) {
      
				var temp = theDiv.style.top;
        temp = temp.replace('px','');
        temp = temp * 1;
				temp = temp - 5;
				theDiv.style.top = temp + "px";
      
		} else {
      
				var temp = theDiv.style.top;
        temp = temp.replace('px','');
        temp = temp * 1;
				temp = temp + 10;
				theDiv.style.top = temp + "px";
			
		}
		setTimeout("animate()", 20);
	}
}

function show_ul(a) {
  oLi = a.lastChild
  
  dropDownSubCat = new Tween(oLi.style,'width',Tween.regularEaseOut,0,130,1,'px');
  dropDownSubCat.start();
  
}

function hide_ul(a) {
  oLi = a.lastChild
  
  dropDownSubCat = new Tween(oLi.style,'width',Tween.regularEaseOut,130,0,1,'px');
  dropDownSubCat.start();
  
}
