function Lvl_openWin(u,n,w,h,l,t,c,f) { //v1.0 4LevelWebs

  var ww=((screen.width-w)/2);if(c==1){l=ww;t=(screen.height-h)/2;}if(c==2){l=ww}

	f+=',top='+t+',left='+l;window.open(u,n,f);

}



function MM_reloadPage(init) {  //reloads the window if Nav4 resized

  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}

  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

}

MM_reloadPage(true);



function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function P7_MultiClass2() { //v1.0 by PVII

 var args=P7_MultiClass2.arguments;if(document.getElementById){

  for(var i=0;i<args.length;i+=2){if(document.getElementById(args[i])!=null){

  if(document.p7setdown){for(var k=0;k<p7dco.length-1;k+=2){

  if(args[i]==p7dco[k]){args[i+1]=p7dco[k+1];break;}}}

  document.getElementById(args[i]).className=args[i+1];}}}

}



function P7_downClass2() { //v1.0 by PVII

 var j,args=P7_downClass2.arguments;if(document.getElementById){

 if(!document.p7setdown){p7dco=new Array();document.p7setdown=true;}

 p7dco.length=0;j=0;for(var i=0;i<args.length;i+=2){

  if(document.getElementById(args[i])!=null){p7dco[j]=args[i];p7dco[j+1]=args[i+1];

  document.getElementById(args[i]).className=args[i+1];j+=2;}}}

}



function P7AniMagic(el, x, y, a, b, c, s) { //v2.8 PVII

 var g,elo=el,f="",m=false,d="";x=parseInt(x);y=parseInt(y);

 var t = 'g.p7Magic = setTimeout("P7AniMagic(\''+elo+'\','; 

 if ((g=MM_findObj(el))!=null) {d=(document.layers)?g:g.style;}else{return;}

 if (parseInt(s)>0) {eval(t+x+','+y+','+a+','+b+','+c+',0)",' + s+')');return;}

 var xx=(parseInt(d.left))?parseInt(d.left):0;

 var yy=(parseInt(d.top))?parseInt(d.top):0;

 if(parseInt(c)==1) {x+=xx;y+=yy;m=true;c=0;}

 else if (c==2) {m=false;clearTimeout(g.p7Magic);}

 else {var i=parseInt(a);

  if (eval(g.moved)){clearTimeout(g.p7Magic);}

  if (xx<x){xx+=i;m=true;if(xx>x){xx=x;}}

  if (xx>x){xx-=i;m=true;if(xx<x){xx=x;}}

  if (yy<y){yy+=i;m=true;if(yy>y){yy=y;}}

  if (yy>y){yy-=i;m=true;if(yy<y){yy=y;}}}

 if (m){if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1)&& navigator.userAgent.indexOf("Opera")==-1){

    xx+="px";yy+="px";}

  d.left=xx;d.top=yy;g.moved=true;eval(t+x+','+y+','+a+','+b+','+c+',0)",'+b+')');

  }else {g.moved=false;}

}

if(typeof(jQuery) != "undefined") {
	// jquery galleria gallery
	jQuery(function($) { 
		if (jQuery('ul.gallery').length > 0) {
			$('ul.gallery').galleria({
					history   : false, // activates the history object for bookmarking, back-button etc.
					clickNext : true, // helper for making the image clickable
					insert    : '#main_image', // the containing selector for our main image
					onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
						
						// fade in the image & caption
						if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
							image.css('display','none').fadeIn(1000);
						}
						caption.css('display','none').fadeIn(1000);
						
						// fetch the thumbnail container
						var _li = thumb.parents('li');
						
						// fade out inactive thumbnail
						_li.siblings().children('img.selected').fadeTo(500,0.3);
						
						// fade in active thumbnail
						thumb.fadeTo('fast',1).addClass('selected');
						
						// add a title for the clickable image
						image.attr('title','Next image >>');
					},
					onThumb : function(thumb) { // thumbnail effects goes here
						
						// fetch the thumbnail container
						var _li = thumb.parents('li');
						
						// if thumbnail is active, fade all the way.
						var _fadeTo = _li.is('.active') ? '1' : '0.3';
						
						// fade in the thumbnail when finnished loading
						thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
						
						// hover effects
						thumb.hover(
							function() { thumb.fadeTo('fast',1); },
							function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
						)
					}
			});
		}
		$(".compareadd input").click(function(){
			/*	if at least one of the compareadd checkboxes
				*	is checked, then display the compare link.
				*	Else hide the link. Modify the qstring of the link
				* to add the selected product codes as a comma
				*	separated list for further processing.
			*/
			var showlink = 0;
			var qstring = "";
			$(".compareadd input").each(function(){
				if ($(this).attr('checked')){
					qstring += showlink>0?","+$(this).val():$(this).val();
					showlink+= 1;
				}
			});
			var complink = "/templates/compare.jsp?comp=" + qstring;
			$(".compareadd a").attr("href",complink);
			showlink>=2?$(".compareadd a").show():$(".compareadd a").hide();
		});
	});
}