

/* opwin
---------------------------------------------------------------------------------------------------- */
function opwin(url, width, height,trg){
if (!!window && url) {
if (!trg) trg = "_blank";
options = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,favorites=no";
var whop = "width="+width+",height="+height+","+options;
win = window.open(url, trg, whop);
win.focus();
}
}

function opwin_c(url, trg, w, h, scroll) {
var win_width = (screen.width - w) / 2;
var win_height = (screen.height - h) / 2;
win_detail = 'height='+h+',width='+w+',top='+win_height+',left='+win_width+',scrollbars='+scroll;
win = window.open(url, trg, win_detail)
 if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


/* rollover
---------------------------------------------------------------------------------------------------- */
function initRollovers() {
	if (!document.getElementById) return
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');
	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className == 'swap') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);
			aImages[i].setAttribute('hsrc', hsrc);
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}
window.onload = initRollovers;


/* scroll
---------------------------------------------------------------------------------------------------- */
//return top
function ReturnTop(){
  if( !document.getElementsByTagName ) {return true;}
  var step=10;
  var max=200;
  var accel=4;
  var interval=30;
  var current_y = document.body.scrollTop;
  var element=document.getElementsByTagName('body');
  if (!element){return true;}
  var target_y = 0;
  for (i = element;i.offsetParent;i=i.offsetParent ){
    target_y += i.offsetTop;
  }
  var count=0;
  if ( current_y > target_y ){ step = -(step); accel = -(accel);}
  var timerid = setInterval(function(){
    if (step<max) step += (count*accel);
    if ( Math.abs(current_y-target_y) < Math.abs(step) ){
      window.scrollTo(document.body.scrollLeft,target_y);
      clearInterval(timerid);
      return false;
    }else{
      window.scrollBy(0,step);
      current_y += step;
      count++;
    }
  },interval);
  return false;
}


//pagescroll
function SmoothScroll(targetID){
  if( !document.getElementById ) {return true;}
  var step=10;
  var max=200;
  var accel=4;
  var interval=30;
  var current_y = document.body.scrollTop;
  var element=document.getElementById(targetID);
  if (!element){return true;}
  var target_y = 0;
  for (i = element;i.offsetParent;i=i.offsetParent ){
    target_y += i.offsetTop;
  }
  var count=0;
  if ( current_y > target_y ){ step = -(step); accel = -(accel);}
  var timerid = setInterval(function(){
    if (step<max) step += (count*accel);
    if ( Math.abs(current_y-target_y) < Math.abs(step) ){
      window.scrollTo(document.body.scrollLeft,target_y);
      clearInterval(timerid);
      return false;
    }else{
      window.scrollBy(0,step);
      current_y += step;
      count++;
    }
  },interval);
  return false;
}



/* rollover - fade
---------------------------------------------------------------------------------------------------- */
$(function(){
$(".fade").load(function(){
	$(this).fadeTo(0, 1.0);
});
$(".fade").hover(
function(){
	$(this).fadeTo(300, 0.5);
},
function(){
	$(this).fadeTo(300, 1.0);
}
);
});

window.onload = function(){
$(".fade").fadeTo(0, 1.0);
};

