
	/*********************************************************************************************/
	/**	Lightbox functions version 1.3															**/
	/** Authors: Michael Markie, Mark Berrecloth												**/
	/** Updates: Still requires a few static variables to change, better image manipulation		**/
	/*********************************************************************************************/

	function openlightbox(multiid,buttonid,lightid,clickid,imgcat,anim,opacityval,opacityval2,offsetx,offsety){	
		var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);

	/*********************************************************************************************/
	/**	Hide lightbox but need to get the size for scaling. 									**/
	/*********************************************************************************************/
//		document.getElementById(multiid).style.visibility	= 'hidden';
//		document.getElementById(multiid).style.display		= 'block';
		var boxHeight										= document.getElementById(multiid).offsetHeight;
		var boxWidth										= document.getElementById(multiid).offsetWidth;
//		document.getElementById(multiid).style.display		= 'none';
//		document.getElementById(multiid).style.visibility	= 'visible';
//		var linkbutton = getY('1_button');
//		alert(linkbutton);
	/*********************************************************************************************/
	/**	Need to get the browser sizes for positioning											**/
	/*********************************************************************************************/		
		var winW = 630, winH = 460;
		if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
		  winW = window.innerWidth;
		  winH = window.innerHeight;
		 }
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
		  winW = document.documentElement.clientWidth;
		  winH = document.documentElement.clientHeight;
		 }else{
		  winW = window.innerWidth;
		  winH = window.innerHeight;
		 }
		}

	/*********************************************************************************************/
	/**	Check if optional arguments were required else center lightbox							**/
	/*********************************************************************************************/
		if(typeof offsetx != 'undefined'){
			var sumx = offsetx;
		} else {
			var sumx = boxWidth / 2;
			sumx = (winW / 2) - sumx;
		}
		if(typeof offsety != 'undefined'){
			var sumy = offsety;
		} else {
			var sumy = boxHeight / 2;
				 sumy = (winH / 2) - sumy;
		} 
	/*********************************************************************************************/
	/**	Set the required amount of opacity to background and box								**/
	/*********************************************************************************************/
		if(typeof opacityval != 'undefined'){
			overlaylightbox(lightid,opacityval);
		} else {
			overlaylightbox(lightid,50);
		}
		if(typeof opacityval2 != 'undefined'){
			overlaylightbox(multiid,opacityval2);
		} else {
			overlaylightbox(multiid,100);
		}
	/*********************************************************************************************/
	/**	Call the display functions							 									**/
	/*********************************************************************************************/
		if(anim!='0') {
			$.expand(buttonid,multiid,imgcat,boxWidth,boxHeight,sumx,sumy);
		} else {
			document.getElementById(multiid).style.left			= "50%";
			document.getElementById(multiid).style.top			= "50%";
			document.getElementById(multiid).style.marginTop	= "-223px";
			document.getElementById(multiid).style.marginLeft	= "-360px";
		}
		
		hideFlash();
//		bod = document.getElementsByTagName('body')[0];
//		bod.style.overflowY = 'hidden';
		if (isIE6){
			hideSelects();
			self.scrollBy(0,-parseInt(document.body.clientHeight))
			
			bod = document.getElementsByTagName('body')[0];
  	//		bod.style.height = document.body.ScrollHeight;
	//		bod.style.width	= '100%';
			bod.style.overflowY = 'hidden';
	//		htm = document.getElementsByTagName('html')[0];
	//		htm.style.height = document.body.scrollHeight;
	//		htm.style.width	= '100%';
		}		
		
		showbox(multiid,lightid,clickid);
	}

	function closelightbox(multiid,buttonid,lightid,clickid,anim){
		var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
		
	/*********************************************************************************************/
	/**	Run if animation is required else hide all box and elements.							**/
	/*********************************************************************************************/
		if(anim!='0'){
			var boxHeight		= document.getElementById(multiid).offsetHeight-4;
			var boxWidth		= document.getElementById(multiid).offsetWidth-4;
			var sumleft			= document.getElementById(buttonid).offsetLeft-4;
			var sumtop			= document.getElementById(buttonid).offsetTop-4;
			var originwidth		= document.getElementById(buttonid).offsetWidth;
			var originheight	= document.getElementById(buttonid).offsetHeight;
			$.contract(multiid,sumleft,sumtop,originwidth,originheight);
		}
		document.getElementById(lightid).style.display	='none';
		document.getElementById(clickid).style.display	='none';
		document.getElementById(multiid).style.display	='none';
		document.getElementById('Close_link').style.display='none';
		showFlash();
//			bod = document.getElementsByTagName('body')[0];
//			bod.style.overflowY = '';

if (isIE6){
			showSelects();
			
			bod = document.getElementsByTagName('body')[0];
			bod.style.overflowY = '';
  	//		bod.style.height = document.body.Height;
		}		
	}

	function showFlash(){
		var flash = document.getElementsByTagName('object');
		for(i=0;i< flash.length; i++){
		   flash[i].style.visibility = 'visible';
		}
	}

	function hideFlash(){
		var flash = document.getElementsByTagName('object');
		for(i=0;i< flash.length;i++){
		   flash[i].style.visibility='hidden';
		}
	}
	
	function showSelects(){
	   var elements = document.getElementsByTagName("select");
	   for (i=0;i< elements.length;i++){
		  elements[i].style.visibility='visible';
	   }
	}
	
	function hideSelects(){
	   var elements = document.getElementsByTagName("select");
	   for (i=0;i< elements.length;i++){
	   elements[i].style.visibility='hidden';
	   }
	}
	
	function overlaylightbox(lightid,opacity){
	/*********************************************************************************************/
	/**	Set the required opacity for background and lightbox. 									**/
	/*********************************************************************************************/
		var light = document.getElementById(lightid).style.opacity;
		var light2 = document.getElementById(lightid).style.filter;
		if(typeof light != 'undefined' || light2 != 'undefined'){
			document.getElementById(lightid).style.filter='alpha(opacity='+opacity+')';
			document.getElementById(lightid).style.opacity=''+opacity/100+'';
		}
	}
	
	function showbox(multiid,lightid,clickid){
	/*********************************************************************************************/
	/**	Display background button and lightbox.				 									**/
	/*********************************************************************************************/
		document.getElementById(lightid).style.display='block';
	 	document.getElementById(clickid).style.display='block';
		document.getElementById(multiid).style.display='block';
		document.getElementById('Close_link').style.display='block';
	}

	function findPos(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		} else if(obj.x) {
        	curleft += obj.x;
			curtop  += obj.y;
		}
		return [curleft,curtop];
	}

	function getY( oElement )
	{
		var iReturnValue = 0;
		
		while( oElement != null ) {
		//	alert(oElement);
			iReturnValue += oElement.offsetTop;
			oElement = oElement.offsetParent;
		}
		return iReturnValue;
	}

//	/*********************************************************************************************/
//	/**	Preps the large image (if exists) for scaling in animation.								**/
//	/*********************************************************************************************/
//	$(document).ready(function(){
//		$("#go1").click(function(){
//			var imgwidth = document.GetElementsByTagName('img').width;
//			var imgheight = document.GetElementsByTagName('img').height;
//			var imgmult = (imgwidth / imgheight);
//		});
//	});
//
//	/*********************************************************************************************/
//	/**	JQuery functions which expands and contracts lightbox									**/
//	/*********************************************************************************************/
//	(function($) {
//		$.extend({
//	/*********************************************************************************************/
//	/**	Expand function which expands the lightbox												**/
//	/*********************************************************************************************/
//			expand: function(source_id, destination_id,imgcat, target_width, target_height, marginleft, margintop) {
//	/*********************************************************************************************/
//	/**	Expand image dimensions fixed sizes such as accessory 400 width by 300 height			**/
//	/*********************************************************************************************/
//				var imgarray;
//				if(imgcat == "acc"){
//				imgarray = new Array("#accimg","400px","300px");
//				}else if(imgcat){
//				
//				}
//	/*********************************************************************************************/
//	/**	getting handles to all element IDs required												**/
//	/*********************************************************************************************/
//				var source = $('#' + source_id );
//				var shadow = $('#' + destination_id);
//				var lightbox = $("#lightbox");
//				var img = $(imgarray[0]);
//	/*********************************************************************************************/
//	/**	If animation is required, set lightbox attributes as origin and animate to required 	**/
//	/**	location																				**/
//	/*********************************************************************************************/
//					img.animate( {width: imgarray[1], height: imgarray[2]},{duration:500} );
//					shadow.width(source.css('width'))
//						  .height(source.css('height'))
//						  .css('top', document.getElementById(source_id).offsetTop)
//						  .css('left', document.getElementById(source_id).offsetLeft)
//						  .show();
//					shadow.animate( { width: target_width, height: target_height,fontSize: "12px", top: margintop, left: marginleft }, { duration:500 } );
//	/*********************************************************************************************/
//	/**	If animation is not required, set lightbox attributes in required location				**/
//	/*********************************************************************************************/
//			}
//		});
//	/*********************************************************************************************/
//	/**	Contract function which decreases lightbox back to original location					**/
//	/*********************************************************************************************/
//		$.extend({
//			contract: function(box_id, target_left, target_top, target_width, target_height) {
//	/*********************************************************************************************/
//	/**	getting handles to all element IDs required												**/
//	/*********************************************************************************************/
//				var shadow = $('#'+box_id);
//				var img = $('#accimg');
//	/*********************************************************************************************/
//	/**	set lightbox and large image attributes and animate back to original location			**/
//	/*********************************************************************************************/
//				shadow.width(shadow.css('width'))
//					  .height(shadow.css('height'))
//					  .css('top', document.getElementById(box_id).offsetTop)
//					  .css('left', document.getElementById(box_id).offsetLeft)
//					  .show();
//				img.animate( {width: "0px", height: "0px"},{duration:600} );
//				shadow.animate({width: target_width, height: target_height, fontSize: "0px", left: target_left, top: target_top, marginLeft: 0, marginTop: 0, opacity: 0.2},{ duration: 600 })
//					  .animate( { left: 'hide', top: 'hide', width: 720, height: 445 }, { duration: 1 } );
//			}
//		});
//		
//	})(jQuery);
//	/*********************************************************************************************/
//	/**	End of lightbox script																	**/
//	/*********************************************************************************************/