// JavaScript Document

//custom and cf related
var handleResultSetSessionVar = function(response){
	//alert(response + ' : set sess handler');
}

function onComplete(numFiles, numSuccessful, numFailed ){
	//alert(numFiles + ':' + numSuccessful+ ':' + numFailed);
	if( numSuccessful == numFiles ){
		document.getElementById("numImages").value = numFiles;
		document.getElementById('upload').innerHTML = '<img src=\"intImages/btn_uploadDone.gif\" alt=\"pictures have been uploaded\" border=\"0\" />';
		document.getElementById('imageFieldSet').innerHTML = '<span style=\'color:gray\'>Step 2 - complete (' + numSuccessful + ' images)</span>';
		document.getElementById("submitButt1").disabled = false;
		document.getElementById("submitButt1").src = '../intImages/btn_submit.gif';
		ColdFusion.Window.hide('uplWin');
	}else {
		document.getElementById('upload').innerHTML = numFailed + " files failed to upload.";
	}
}

applyWin = function(){
	var Xc = screen.width/2 - 350;
	ColdFusion.Window.show('wanaWin');
	var g = ColdFusion.Window.getWindowObject('wanaWin');
	g.moveTo(Xc,50);
}

<!---had to abandon using cfwindow.create on the apply and upload windows because of the myriad problems related to cfwindow,javascript and out request strt frone end controller scheme, so the windows are embedded in index.cfm with no show and hack to place them off screen initially also the order in which wiondows are created is important i.e. even if a window appears to be on top of another if it was created first it will baheave as if it were behind e.g. flash buttons non clickable--->
function uplWin(){
var Xc = screen.width/2 - 300;
ColdFusion.Window.create('uplWin', 'Upload your pictures','frm_Upload.cfm',{x:Xc,y:50,height:280,width:600,modal:true,closable:true,draggable:true,resizable:true,center:false,initshow:true,minheight:200,minwidth:200,_cf_refreshOnShow:true});
}


sendWanaForm = function(){
	var numImages = ColdFusion.getElementValue('numImages');
	var name = ColdFusion.getElementValue('name');
	var location = ColdFusion.getElementValue('location');
	var email = ColdFusion.getElementValue('email');
	var dob = ColdFusion.getElementValue('dob');
	var tel = ColdFusion.getElementValue('tel');
	//alert('send wana ' + name + ','+ email+ ',' + dob+ ',' + tel+ ',' + numImages);
	var dataproxy = new utilProxy();
	dataproxy.setCallbackHandler(handleResultsendWanaB);
	dataproxy.doApplicant(name,email,dob,tel,numImages,location);	
}

function handleResultsendWanaB(response){
if(response){
	//alert(response);
	//ColdFusion.Window.hide("wanaWin");
	//var U = 'edit.cfm?cfgridkey=' + Userid;
	ColdFusion.navigate("frm_wana_response.cfm","wanaWin");
	//ColdFusion.navigate("wanaWin.cfm?response=good","wanaWin");
}else{
	alert('Sorry there was no response from the server!')
	}
}

function closeWanaWin(){
	ColdFusion.Window.hide("wanaWin");
}
 
MLboxWin = function(){
	var U = 'frm_sendMLbox.cfm';
	var Xc = screen.width/2 - 300;
	ColdFusion.Window.create('sendMLBWin', 'Email this lightbox',U,{x:Xc,y:50,height:500,width:700,modal:true,closable:true,draggable:true,resizable:true,center:false,initshow:true,minheight:200,minwidth:200,_cf_refreshOnShow:true})
}

sendMLBox = function(){
	var sender = ColdFusion.getElementValue('eSender');
	var recip = ColdFusion.getElementValue('eRecip');
	var title = ColdFusion.getElementValue('lbTitle');
	var messg = ColdFusion.getElementValue('msg');
	var LBlist =  ColdFusion.getElementValue('lBoxList');
	var dataproxy = new utilProxy();
	dataproxy.setCallbackHandler(handleResultsendMLB);
	dataproxy.emailLightBox(recip,sender,title,messg,LBlist);	
}

function handleResultsendMLB(response){
if(response){
	//alert(response);
	ColdFusion.Window.hide("sendMLBWin");
	//ColdFusion.navigate("testsendMLBox.cfm?response=good","sendMLBWin");
}else{
	alert('no response')
	}
}

function handleResultDelFromCart(response){
	var valueArray = response.split(":");
	var numInLbox = valueArray[0];
	var idToDel =  valueArray[1];
	var parent = document.getElementById('sliderUL').childNodes[0];
	var child = document.getElementById(idToDel);
	parent.removeChild(child);
	if(numInLbox ==0){
		document.getElementById('lbox_iconTop').innerHTML = '<img src=\"http://www.sourcemodels.co.uk/intImages/icon_lb_top.png\" alt=\"In light box\" border=\"0\" width=\"18\" height=\"18\" />';
	}
}

function handleResultDTL(response){
	if(response){
		//change the add to lightbox icon
		var theID = 'iconLbox' + response;
		document.getElementById(theID).innerHTML = '<img src=\"http://www.sourcemodels.co.uk/intImages/but_isInLbox.png\" alt=\"In light box\" border=\"0\" width=\"16\" height=\"16\" />';
		document.getElementById('lbox_iconTop').innerHTML = '<img src=\"http://www.sourcemodels.co.uk/intImages/but_isInLbox.png\" alt=\"In light box\" border=\"0\" width=\"18\" height=\"18\" />';
		var g = document.getElementById(theID).innerHTML;
		//alert('response: ' + g);
	}else{
		alert('no response from the function');
	}
}
function handleResultDTLTab(response){
	if(response){
		//alert('response: ' + response);
		//change the add to lightbox icon
		var theID = 'iconLbox' + response;
		var g = document.getElementById(theID).innerHTML;
		document.getElementById(theID).innerHTML = '<img src=\"/intImages/but_inLB_tab.png\" alt=\"In light box\" border=\"0\" />';
	}else{
		alert('no response from the function');
	}
}

function addToLbox(ID){ 
	//alert('add to lb' + ID);
	var dataproxy = new utilProxy();
	dataproxy.setCallbackHandler(handleResultDTL);
	dataproxy.addToLbox(ID);
}
function addToLboxTab(ID){ 
	//alert('add to lb' + ID);
	var dataproxy = new utilProxy();
	dataproxy.setCallbackHandler(handleResultDTLTab);
	dataproxy.addToLbox(ID);
}
function delLbox(ID){ 
	//alert('remove from lb ' + ID);
	var dataproxy = new utilProxy();
	dataproxy.setCallbackHandler(handleResultDelFromCart);
	dataproxy.delLbox(ID);
}

function handleResultClearCart(response){
	//alert(response);
	location.reload(true);
}

function clearLbox(){ 
	//alert('remove from lb ' + ID);
	var dataproxy = new utilProxy();
	dataproxy.setCallbackHandler(handleResultClearCart);
	dataproxy.clearLbox();
}

//used in menu search field
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
		thefield.value = ""
} 
//end custom and cf related




function passBack(){
	//alert('clicked');
	window.addEvent('domready', Lightbox.close.bind(Lightbox));
	return;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//show hide and load functions for the model details	
var detailsShowing = 1;
var infoShowing = 0;
function showDetails(){
	if(detailsShowing ==0){
		hideInfo();
		MM_showHideLayers('modelDetails','','show');
		detailsShowing =1;
	}else{
		MM_showHideLayers('modelDetails','','hide');
		detailsShowing =0;
	}
}

function showInfo(){
	if(infoShowing ==0){
		hideDetails();
		MM_showHideLayers('modelInfo','','show');
		infoShowing =1;
	}else{
		MM_showHideLayers('modelInfo','','hide');
		infoShowing =0;
	}
}

function hideDetails(){
	MM_showHideLayers('modelDetails','','hide');
	detailsShowing =0;
}
function hideInfo(){
	MM_showHideLayers('modelInfo','','hide');
	infoShowing =0;
}

	var loadMainImg = function(img){
	var img =  img;
	MM_showHideLayers('mainImage','','hide');
	MM_showHideLayers('defaultMainImage','','hide');
	hideDetails();
	hideInfo();
	document.getElementById('mainImage').innerHTML = 'loading image';
	MM_showHideLayers('mainImage','','hide');
	MM_showHideLayers('mainImage','','show');
	document.getElementById('mainImage').innerHTML = '<img src=\"' + img +'\" alt=\"Main Image\" border=\"0\" width=\"340\" height=\"460\" />';
	
}
//end model detail functions

//flash and swf object loaders
function loadSplashTester(x){
			var flashvars = {};
			var params = {};
			params.wmode = "transparent";
			flashvars.albID = x;
			var attributes = {};
			attributes.id = "splashSamples";
			swfobject.embedSWF("swf/SplashTester.swf", "splashSamples", "980", "512", "8.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
}

function loadSplash(x,y){
			var flashvars = {};
			flashvars.f = x;
			if(y != undefined){
				flashvars.hold = true;
			}
			var params = {};
			params.wmode = "transparent";
			var attributes = {};
			attributes.id = "splashContent";
			swfobject.embedSWF("swf/Splash.swf", "splashContent", "980", "512", "8.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
}

function loadPanel(x,y){
			var flashvars = {};
			flashvars.f = x;
			if(y != undefined){
				flashvars.hold = true;
			}
			var params = {};
			params.wmode = "transparent";
			var attributes = {};
			attributes.id = "panelContent";
			swfobject.embedSWF("swf/source_g-blocks.swf", "panelContent", "240", "70", "8.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
}
function loadSlide(x){
			var flashvars = {};
			var params = {};
			params.wmode = "transparent";
			flashvars.albID = x;
			flashvars.domain = "http://www.sourcemodels.co.uk/";
			var attributes = {};
			attributes.id = "slideBox";
			swfobject.embedSWF("swf/sShow.swf", "slideBox", "50", "340", "8.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
}
//end flash and swf


//from mainscript.cfm
function PromptMe() {
        // some application vars
		var origTitle = document.title;
        var stateVar = "",
		displayDiv = document.getElementById("HistoryState");
        this.promtForNew = function(x) {
			// do the stuff that changes the state
			var newVal = x;
			unFocus.History.addHistory(newVal);
        };
        
        this.historyListener = function(historyHash) {
			// update the stateVar
			stateVar = historyHash;
			if(historyHash == ''){
				sPane=0;
				}else{
					sPane = parseInt(historyHash);
				}
			document.title = origTitle;
        };
        unFocus.History.addEventListener('historyChange', this.historyListener);
        this.historyListener(unFocus.History.getCurrent());
};



$(function() {
$('#multiples a').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	showBody: " - ",
	fade: 250,
	top: -10,
	right: 10
});

$("#block").click($.tooltip.block);

});

jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

//end from mainscript

// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(function( $ ){
	$('#innerDetTh').serialScroll({
		target:'#detthumbsContainerSlide',
		items:'li', // Selector to the items ( relative to the matched elements, '#thumbsContainer' in this case )
		prev:'img.prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'img.next',// Selector to the 'next' button (absolute too)
		axis:'x',// The default is 'y' scroll on both ways
		navigation:'#navigation li a',
		duration:500,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		
		//queue:false,// We scroll on both axes, scroll both at the same time.
		//event:'click',// On which event to react (click is the default, you probably won't need to specify it)
		//stop:false,// Each click will stop any previous animations of the target. (false by default)
		//lock:true, // Ignore events if already animating (true by default)		
		//start: 0, // On which element (index) to begin ( 0 is the default, redundant in this case )		
		cycle:false,// Cycle endlessly ( constant velocity, true is the default )
		//step:1, // How many items to scroll each time ( 1 is the default, no need to specify )
		//jump:false, // If true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
		lazy:true,// (default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
		//interval:1000, // It's the number of milliseconds to automatically go to the next
		//constant:true, // constant speed
		
		onBefore:function( e, elem, $pane, $items, pos ){
			e.preventDefault();
			$(".loading").hide();
			if( this.blur )
				this.blur();
		},
		onAfter:function( elem ){
				$(".loading").fadeIn("slow");
		}
	});
});

jQuery(function( $ ){

	$('#inner2').serialScroll({
		target:'#thumbsContainerSlide',
		items:'li', // Selector to the items ( relative to the matched elements, '#thumbsContainer' in this case )
		prev:'img.prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'img.next',// Selector to the 'next' button (absolute too)
		axis:'x',// The default is 'y' scroll on both ways
		navigation:'#navigation li a',
		duration:500,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		start:sPane, // On which element (index) to begin ( 0 is the default, redundant in this case )		
		cycle:false,// Cycle endlessly ( constant velocity, true is the default )
		lazy:false,// (default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
		
		onBefore:function( e, elem, $pane, $items, pos ){ 
		$prev = $('#prev'),//prev button
		$next = $('#next');//next button
		demoApp.promtForNew(pos);
			$prev.add($next).show();
			if( pos == 0 )
				$prev.hide();
			else if( pos == $items.length-1 )
				$next.hide();
		var dataproxy = new utilProxy();
		dataproxy.setCallbackHandler(handleResultSetSessionVar);
		dataproxy.setSessionVar(pos);
		
			e.preventDefault();
			$(".loading").hide();
			if( this.blur )
				this.blur();
		},
		onAfter:function( elem ){
				$(".loading").fadeIn("slow");
		}
	});
});
/*
unFocus.EventManager, version 1.0 (svn $Revision: 32 $) $Date: 2009-06-13 03:32:05 -0400 (Sat, 13 Jun 2009) $
Copyright: 2005-2009, Kevin Newman (http://www.unfocus.com/)
http://www.opensource.org/licenses/mit-license.php
*/
// Package: unFocus.Utilities
// make sure faux-namespace is available before adding to it
if (!window.unFocus) var unFocus = {};

/** Class: EventManager
 *	Provides the interface and functionality to a Subscriber/Subscriber Pattern.
 * 
 **/
/*
Constructor: EventManager
	The Constructor (Prototype) function.

Parameters:
	[type1 [, type2 [, etc.]]] - Optionally sets up an empty array for each named event.
*/
unFocus.EventManager = function() {
	this._listeners = {};
	for (var i = 0; i < arguments.length; i++) {
		this._listeners[arguments[i]] = [];
	}
};

unFocus.EventManager.prototype = {
	/*
	Method: addEventListener
		Adds an event listener to the specified type.

	Parameters:
		$name		- The event name.
		$listener	- The function to be called when the event fires.
	*/
	addEventListener: function($name, $listener) {
		// check that listener is not in list
		for (var i = 0; i < this._listeners[$name].length; i++)
			if (this._listeners[$name][i] == $listener) return;
		// add listener to appropriate list
		this._listeners[$name].push($listener);
	},
	/*
	Method: removeEventListener
		Removes an event listener.
	
	Parameters:
		$name		- The event name.
		$listener	- The function to be removed.
	*/
	removeEventListener: function($name, $listener) {
		// search for the listener method
		for (var i = 0; i < this._listeners[$name].length; i++) {
			if (this._listeners[$name][i] == $listener) {
				this._listeners.splice(i,1);
				return;
			}
		}
	},
	/* Method: notifyListeners
		Notifies the listeners of an event.
	
	Parameters:
		$name	- The name of event to fire.
		$data	- The object to pass to the subscribed method (the Event Object).
	*/
	notifyListeners: function($name, $data) {
		for (var i = 0; i < this._listeners[$name].length; i++)
			this._listeners[$name][i]($data);
	}
};

/*
unFocus.History, version 2.0 (beta 1) (svn $Revision: 32 $) $Date: 2009-06-13 03:32:05 -0400 (Sat, 13 Jun 2009) $
Copyright: 2005-2009, Kevin Newman (http://www.unfocus.com/)
http://www.opensource.org/licenses/mit-license.php
*/

/*
	Class: unFocus.History
		A singleton with subscriber interface (<unFocus.EventManager>) 
		that keeps a history and provides deep links for Flash and AJAX apps
*/
unFocus.History = (function() {

function Keeper() {
	
	var _this = this,
		// set the poll interval here.
		_pollInterval = 200, _intervalID,
		_currentHash;

	/*
	method: _getHash
		A private method that gets the Hash from the location.hash property.
	 
	returns:
		a string containing the current hash from the url
	*/
	var _getHash = function() {
		return location.hash.substring(1);
	};
	// get initial hash
	_currentHash = _getHash();
	
	/*
	method: _setHash
		A private method that sets the Hash on the location string (the current url).
	*/
	var _setHash = function($newHash) {
		window.location.hash = $newHash;
	};
	
	/*
	method: _watchHash
		A private method that is called every n miliseconds (<_pollInterval>) to check if the hash has changed.
		This is the primary Hash change detection method for most browsers. It doesn't work to detect the hash
		change in IE 5.5+ or various other browsers. Workarounds like the iframe method are used for those 
		browsers (IE 5.0 will use an anchor creation hack).
	*/
	function _watchHash() {
		var $newHash = _getHash();
		if (_currentHash != $newHash) {
			_currentHash = $newHash;
			_this.notifyListeners("historyChange", $newHash);
		}
	}
	// Put the hash check on a timer.
	if (setInterval) _intervalID = setInterval(_watchHash, _pollInterval);
	
	/*
	method: getCurrentBookmark
		A public method to retrieve the current history string.
	
	returns:
		The current History Hash
	*/
	_this.getCurrent = function() {
		return _currentHash;
	};
	
	/*
	method: addHistory
		A public method to add a new history, and set the deep link. This method should be given a string.
		It does no serialization.
	
	returns:
		Boolean - true if supported and set, false if not
	*/
	_this.addHistory = function addHistory($newHash) {
		if (_currentHash != $newHash) {
			_currentHash = $newHash;
			_setHash($newHash);
			_this.notifyListeners("historyChange",$newHash);
		}
		return true;
	};

	/**
	 * These are the platform specific override methods. Since some platforms (IE 5.5+, Safari)
	 * require almost completely different techniques to create history entries, browser detection is
	 * used and the appropriate method is created. The bugs these fixes address are very tied to the
	 * specific implementations of these browsers, and not necessarily the underlying html engines.
	 * Sometimes, bugs related to history management can be tied even to a specific skin in browsers
	 * like Opera.
	 */
	// opera
	if (history.navigationMode)
		history.navigationMode = 'compatible';
	
	// Safari 2.04 and less (and WebKit less than 420 - these hacks are not needed by the most recent nightlies)
	// :TODO: consider whether this aught to check for Safari or WebKit - is this a safar problem, or a does it
	// happen in other WebKit based software? OmniWeb (WebKit 420+) seems to work, though there's a sync issue.
	if (/WebKit\/\d+/.test(navigator.appVersion) && navigator.appVersion.match(/WebKit\/(\d+)/)[1] < 420) {
		// this will hold the old history states, since they can't be reliably taken from the location object
		var _unFocusHistoryLength = history.length,
			_historyStates = {}, _form,
			_recentlyAdded = false;
		
		// Setting the hash directly in Safari seems to cause odd content refresh behavior.
		// We'll use a form to submit to a #hash location instead. I'm assuming this works,
		// since I saw it done this way in SwfAddress (gotta give credit where credit it due ;-) ).
		function _createSafariSetHashForm() {
			_form = document.createElement("form");
			_form.id = "unFocusHistoryForm";
			_form.method = "get";

			document.body.insertBefore(_form,document.body.firstChild);
		}
		
		// override the old _setHash method to use the new form
		_setHash = function($newHash) {
			_historyStates[_unFocusHistoryLength] = $newHash;
			_form.action = "#" + _getHash();
			_form.submit();
		};
		
		// override the old _getHash method, since Safari doesn't update location.hash (fixed in nightlies)
		_getHash = function() {
			return _historyStates[_unFocusHistoryLength];
		};
		
		// set initial history entry
		_historyStates[_unFocusHistoryLength] = _currentHash;
		
		function addHistorySafari($newHash) {
			if (_currentHash != $newHash) {
				_currentHash = $newHash;
				_unFocusHistoryLength = history.length+1;
				_recentlyAdded = true;
				_setHash($newHash);
				_this.notifyListeners("historyChange",$newHash);
				_recentlyAdded = false;
			}
			return true;
		}
		
		// provide alternative addHistory
		_this.addHistory = function($newHash) { // adds history and bookmark hash
			// setup the form fix
			_createSafariSetHashForm();
			
			// replace with slimmer version...
			// :TODO: rethink this - it's adding an extra scope to the chain, which might
			// actually cost more at runtime than a simple if statement. Can this be done
			// without adding to the scope chain? The replaced scope holds no values. Does
			// it keep it's place in the scope chain?
			_this.addHistory = addHistorySafari;
			
			// ...do first call
			return _this.addHistory($newHash);
		};
		function _watchHistoryLength() {
			if (!_recentlyAdded) {
				var _historyLength = history.length;
				if (_historyLength != _unFocusHistoryLength) {
					_unFocusHistoryLength = _historyLength;
					
					var $newHash = _getHash();
					if (_currentHash != $newHash) {
						_currentHash = $newHash;
						_this.notifyListeners("historyChange", $newHash);
					}
				}
			}
		};
		
		// since it doesn't work, might as well cancel the location.hash check
		clearInterval(_intervalID);
		// watch the history.length prop for changes instead
		_intervalID = setInterval(_watchHistoryLength, _pollInterval);
		
	// IE 5.5+ Windows
	} else if (/*@cc_on!@*/0 && navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1] >= 5.5) {
		
		// :HACK: Quick and dirty IE8 support (makes IE8 use standard timer method).
		if (document.documentMode && document.documentMode >= 8)
			return;
		
		/* iframe references */
		var _historyFrameObj, _historyFrameRef;
		
		/*
		method: _createHistoryFrame
			
			This is for IE only for now.
		*/
		function _createHistoryFrame() {
			var $historyFrameName = "unFocusHistoryFrame";
			_historyFrameObj = document.createElement("iframe");
			_historyFrameObj.setAttribute("name", $historyFrameName);
			_historyFrameObj.setAttribute("id", $historyFrameName);
			// :NOTE: _Very_ experimental
			_historyFrameObj.setAttribute("src", 'javascript:;');
			_historyFrameObj.style.position = "absolute";
			_historyFrameObj.style.top = "-900px";
			document.body.insertBefore(_historyFrameObj,document.body.firstChild);
			// get reference to the frame from frames array (needed for document.open)
			// :NOTE: there might be an issue with this according to quirksmode.org
			// http://www.quirksmode.org/js/iframe.html
			_historyFrameRef = frames[$historyFrameName];
			
			// add base history entry
			_createHistoryHTML(_currentHash, true);
		}
		
		/*
		method: _createHistoryHTML
			This is an alternative to <_setHistoryHTML> that is used by IE (and others if I can get it to work).
			This method will create the history page completely in memory, with no need to download a new file
			from the server.
		*/
		function _createHistoryHTML($newHash) {
			with (_historyFrameRef.document) {
				open("text/html");
				write("<html><head></head><body onl",
					'oad="parent.unFocus.History._updateFromHistory(\''+$newHash+'\');">',
					$newHash+"</body></html>");
				close();
			}
		}
		
		/*
		method: _updateFromHistory
			A private method that is meant to be called only from HistoryFrame.html.
			It is not meant to be used by an end user even though it is accessable as public.
		*/
			// hides the first call to the method, and sets up the real method for the rest of the calls
		function updateFromHistory($hash) {
			_currentHash = $hash;
			_this.notifyListeners("historyChange", $hash);
		}
		_this._updateFromHistory = function() {
			_this._updateFromHistory = updateFromHistory;
		};

		function addHistoryIE($newHash) { // adds history and bookmark hash
			if (_currentHash != $newHash) {
				// :NOTE: IE will create an entry if there is an achor on the page, but it
				// does not allow you to detect the state change.
				_currentHash = $newHash;
				// sets hash and notifies listeners
				_createHistoryHTML($newHash);
			}
			return true;
		};
		_this.addHistory = function($newHash) {
			// do initialization stuff on first call
			_createHistoryFrame();
			
			// replace this function with a slimmer one on first call
			_this.addHistory = addHistoryIE;
			// call the first call
			return _this.addHistory($newHash);
		};
		// anonymous method - subscribe to self to update the hash when the history is updated
		_this.addEventListener("historyChange", function($hash) { _setHash($hash) });
		
	}
}
Keeper.prototype = new unFocus.EventManager("historyChange");

return new Keeper();

})();

//pretty photo
(function($){$.prettyPhoto={version:'2.5.4'};$.fn.prettyPhoto=function(settings){settings=jQuery.extend({animationSpeed:'normal',padding:40,opacity:0.80,showTitle:false,allowresize:true,counter_separator_label:'/',theme:'light_rounded',hideflash:false,modal:false,changepicturecallback:function(){},callback:function(){}},settings);if($.browser.msie&&$.browser.version==6){settings.theme="light_square";}
if($('.pp_overlay').size()==0){_buildOverlay();}else{$pp_pic_holder=$('.pp_pic_holder');$ppt=$('.ppt');}
var doresize=true,percentBased=false,correctSizes,$pp_pic_holder,$ppt,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,pp_type='image',setPosition=0,$scrollPos=_getScroll();$(window).scroll(function(){$scrollPos=_getScroll();_centerOverlay();_resizeOverlay();});$(window).resize(function(){_centerOverlay();_resizeOverlay();});$(document).keydown(function(e){if($pp_pic_holder.is(':visible'))
switch(e.keyCode){case 37:$.prettyPhoto.changePage('previous');break;case 39:$.prettyPhoto.changePage('next');break;case 27:if(!settings.modal)
$.prettyPhoto.close();break;};});$(this).each(function(){$(this).bind('click',function(){link=this;theRel=$(this).attr('rel');galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var images=new Array(),titles=new Array(),descriptions=new Array();if(theGallery){$('a[rel*='+theGallery+']').each(function(i){if($(this)[0]===$(link)[0])setPosition=i;images.push($(this).attr('href'));titles.push($(this).find('img').attr('alt'));descriptions.push($(this).attr('title'));});}else{images=$(this).attr('href');titles=($(this).find('img').attr('alt'))?$(this).find('img').attr('alt'):'';descriptions=($(this).attr('title'))?$(this).attr('title'):'';}
$.prettyPhoto.open(images,titles,descriptions);return false;});});$.prettyPhoto.open=function(gallery_images,gallery_titles,gallery_descriptions){if($.browser.msie&&$.browser.version==6){$('select').css('visibility','hidden');};if(settings.hideflash)$('object,embed').css('visibility','hidden');images=$.makeArray(gallery_images);titles=$.makeArray(gallery_titles);descriptions=$.makeArray(gallery_descriptions);if($('.pp_overlay').size()==0){_buildOverlay();}else{$pp_pic_holder=$('.pp_pic_holder');$ppt=$('.ppt');}
$pp_pic_holder.attr('class','pp_pic_holder '+settings.theme);isSet=($(images).size()>0)?true:false;_getFileType(images[setPosition]);_centerOverlay();_checkPosition($(images).size());$('.pp_loaderIcon').show();$('div.pp_overlay').show().fadeTo(settings.animationSpeed,settings.opacity,function(){$pp_pic_holder.fadeIn(settings.animationSpeed,function(){$pp_pic_holder.find('p.currentTextHolder').text((setPosition+1)+settings.counter_separator_label+$(images).size());if(descriptions[setPosition]){$pp_pic_holder.find('.pp_description').show().html(unescape(descriptions[setPosition]));}else{$pp_pic_holder.find('.pp_description').hide().text('');};if(titles[setPosition]&&settings.showTitle){hasTitle=true;$ppt.html(unescape(titles[setPosition]));}else{hasTitle=false;};if(pp_type=='image'){imgPreloader=new Image();nextImage=new Image();if(isSet&&setPosition>$(images).size())nextImage.src=images[setPosition+1];prevImage=new Image();if(isSet&&images[setPosition-1])prevImage.src=images[setPosition-1];pp_typeMarkup='<img id="fullResImage" src="" />';$pp_pic_holder.find('#pp_full_res')[0].innerHTML=pp_typeMarkup;$pp_pic_holder.find('.pp_content').css('overflow','hidden');$pp_pic_holder.find('#fullResImage').attr('src',images[setPosition]);imgPreloader.onload=function(){correctSizes=_fitToViewport(imgPreloader.width,imgPreloader.height);_showContent();};imgPreloader.src=images[setPosition];}else{movie_width=(parseFloat(grab_param('width',images[setPosition])))?grab_param('width',images[setPosition]):"425";movie_height=(parseFloat(grab_param('height',images[setPosition])))?grab_param('height',images[setPosition]):"344";if(movie_width.indexOf('%')!=-1||movie_height.indexOf('%')!=-1){movie_height=($(window).height()*parseFloat(movie_height)/100)-100;movie_width=($(window).width()*parseFloat(movie_width)/100)-100;percentBased=true;}
movie_height=parseFloat(movie_height);movie_width=parseFloat(movie_width);if(pp_type=='quicktime')movie_height+=15;correctSizes=_fitToViewport(movie_width,movie_height);if(pp_type=='youtube'){pp_typeMarkup='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+correctSizes['width']+'" height="'+correctSizes['height']+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.youtube.com/v/'+grab_param('v',images[setPosition])+'" /><embed src="http://www.youtube.com/v/'+grab_param('v',images[setPosition])+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+correctSizes['width']+'" height="'+correctSizes['height']+'"></embed></object>';}else if(pp_type=='quicktime'){pp_typeMarkup='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="'+correctSizes['height']+'" width="'+correctSizes['width']+'"><param name="src" value="'+images[setPosition]+'"><param name="autoplay" value="true"><param name="type" value="video/quicktime"><embed src="'+images[setPosition]+'" height="'+correctSizes['height']+'" width="'+correctSizes['width']+'" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>';}else if(pp_type=='flash'){flash_vars=images[setPosition];flash_vars=flash_vars.substring(images[setPosition].indexOf('flashvars')+10,images[setPosition].length);filename=images[setPosition];filename=filename.substring(0,filename.indexOf('?'));pp_typeMarkup='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+correctSizes['width']+'" height="'+correctSizes['height']+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+filename+'?'+flash_vars+'" /><embed src="'+filename+'?'+flash_vars+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+correctSizes['width']+'" height="'+correctSizes['height']+'"></embed></object>';}else if(pp_type=='iframe'){movie_url=images[setPosition];movie_url=movie_url.substr(0,movie_url.indexOf('iframe')-1);pp_typeMarkup='<iframe src ="'+movie_url+'" width="'+(correctSizes['width']-10)+'" height="'+(correctSizes['height']-10)+'" frameborder="no"></iframe>';}
_showContent();}});});};$.prettyPhoto.changePage=function(direction){if(direction=='previous'){setPosition--;if(setPosition<0){setPosition=0;return;}}else{if($('.pp_arrow_next').is('.disabled'))return;setPosition++;};if(!doresize)doresize=true;_hideContent();$('a.pp_expand,a.pp_contract').fadeOut(settings.animationSpeed,function(){$(this).removeClass('pp_contract').addClass('pp_expand');$.prettyPhoto.open(images,titles,descriptions);});};$.prettyPhoto.close=function(){$pp_pic_holder.find('object,embed').css('visibility','hidden');$('div.pp_pic_holder,div.ppt').fadeOut(settings.animationSpeed);$('div.pp_overlay').fadeOut(settings.animationSpeed,function(){$('div.pp_overlay,div.pp_pic_holder,div.ppt').remove();if($.browser.msie&&$.browser.version==6){$('select').css('visibility','visible');};if(settings.hideflash)$('object,embed').css('visibility','visible');setPosition=0;settings.callback();});doresize=true;};_showContent=function(){$('.pp_loaderIcon').hide();if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth;}else{windowHeight=$(window).height();windowWidth=$(window).width();};projectedTop=$scrollPos['scrollTop']+((350)-(correctSizes['containerHeight']/2));if(projectedTop<0)projectedTop=0+$pp_pic_holder.find('.ppt').height();$pp_pic_holder.find('.pp_content').animate({'height':correctSizes['contentHeight']},settings.animationSpeed);$pp_pic_holder.animate({'top':projectedTop,'left':((windowWidth/2)-(correctSizes['containerWidth']/2)),'width':correctSizes['containerWidth']},settings.animationSpeed,function(){$pp_pic_holder.width(correctSizes['containerWidth']);$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(correctSizes['height']).width(correctSizes['width']);$pp_pic_holder.find('#pp_full_res').fadeIn(settings.animationSpeed);if(isSet&&pp_type=="image"){$pp_pic_holder.find('.pp_hoverContainer').fadeIn(settings.animationSpeed);}else{$pp_pic_holder.find('.pp_hoverContainer').hide();}
$pp_pic_holder.find('.pp_details').fadeIn(settings.animationSpeed);if(settings.showTitle&&hasTitle){$ppt.css({'top':$pp_pic_holder.offset().top-20,'left':$pp_pic_holder.offset().left+(settings.padding/2),'display':'none'});$ppt.fadeIn(settings.animationSpeed);};if(correctSizes['resized'])$('a.pp_expand,a.pp_contract').fadeIn(settings.animationSpeed);if(pp_type!='image')$pp_pic_holder.find('#pp_full_res')[0].innerHTML=pp_typeMarkup;settings.changepicturecallback();});};function _hideContent(){$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');$pp_pic_holder.find('.pp_hoverContainer,.pp_details').fadeOut(settings.animationSpeed);$pp_pic_holder.find('#pp_full_res').fadeOut(settings.animationSpeed,function(){$('.pp_loaderIcon').show();});$ppt.fadeOut(settings.animationSpeed);}
function _checkPosition(setCount){if(setPosition==setCount-1){$pp_pic_holder.find('a.pp_next').css('visibility','hidden');$pp_pic_holder.find('a.pp_arrow_next').addClass('disabled').unbind('click');}else{$pp_pic_holder.find('a.pp_next').css('visibility','visible');$pp_pic_holder.find('a.pp_arrow_next.disabled').removeClass('disabled').bind('click',function(){$.prettyPhoto.changePage('next');return false;});};if(setPosition==0){$pp_pic_holder.find('a.pp_previous').css('visibility','hidden');$pp_pic_holder.find('a.pp_arrow_previous').addClass('disabled').unbind('click');}else{$pp_pic_holder.find('a.pp_previous').css('visibility','visible');$pp_pic_holder.find('a.pp_arrow_previous.disabled').removeClass('disabled').bind('click',function(){$.prettyPhoto.changePage('previous');return false;});};if(setCount>1){$('.pp_nav').show();}else{$('.pp_nav').hide();}};function _fitToViewport(width,height){hasBeenResized=false;_getDimensions(width,height);imageWidth=width;imageHeight=height;windowHeight=$(window).height();windowWidth=$(window).width();if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allowresize&&!percentBased){hasBeenResized=true;notFitting=true;while(notFitting){if((pp_containerWidth>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(height/width)*imageWidth;}else if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(width/height)*imageHeight;}else{notFitting=false;};pp_containerHeight=imageHeight;pp_containerWidth=imageWidth;};_getDimensions(imageWidth,imageHeight);};return{width:imageWidth,height:imageHeight,containerHeight:pp_containerHeight,containerWidth:pp_containerWidth,contentHeight:pp_contentHeight,contentWidth:pp_contentWidth,resized:hasBeenResized};};function _getDimensions(width,height){$pp_pic_holder.find('.pp_details').width(width).find('.pp_description').width(width-parseFloat($pp_pic_holder.find('a.pp_close').css('width')));pp_contentHeight=height+$pp_pic_holder.find('.pp_details').height()+parseFloat($pp_pic_holder.find('.pp_details').css('marginTop'))+parseFloat($pp_pic_holder.find('.pp_details').css('marginBottom'));pp_contentWidth=width;pp_containerHeight=pp_contentHeight+$pp_pic_holder.find('.ppt').height()+$pp_pic_holder.find('.pp_top').height()+$pp_pic_holder.find('.pp_bottom').height();pp_containerWidth=width+settings.padding;}
function _getFileType(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)){pp_type='youtube';}else if(itemSrc.indexOf('.mov')!=-1){pp_type='quicktime';}else if(itemSrc.indexOf('.swf')!=-1){pp_type='flash';}else if(itemSrc.indexOf('iframe')!=-1){pp_type='iframe'}else{pp_type='image';};};function _centerOverlay(){if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth;}else{windowHeight=$(window).height();windowWidth=$(window).width();};if(doresize){$pHeight=$pp_pic_holder.height();$pWidth=$pp_pic_holder.width();$tHeight=$ppt.height();projectedTop=(windowHeight/2)+$scrollPos['scrollTop']-($pHeight/2);if(projectedTop<0)projectedTop=0+$tHeight;$pp_pic_holder.css({'top':projectedTop,'left':(windowWidth/2)+$scrollPos['scrollLeft']-($pWidth/2)});$ppt.css({'top':projectedTop-$tHeight,'left':(windowWidth/2)+$scrollPos['scrollLeft']-($pWidth/2)+(settings.padding/2)});};};function _getScroll(){if(self.pageYOffset){scrollTop=self.pageYOffset;scrollLeft=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){scrollTop=document.documentElement.scrollTop;scrollLeft=document.documentElement.scrollLeft;}else if(document.body){scrollTop=document.body.scrollTop;scrollLeft=document.body.scrollLeft;}
return{scrollTop:scrollTop,scrollLeft:scrollLeft};};function _resizeOverlay(){$('div.pp_overlay').css({'height':$(document).height(),'width':$(window).width()});};function _buildOverlay(){toInject="";toInject+="<div class='pp_overlay'></div>";toInject+='<div class="pp_pic_holder"><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_loaderIcon"></div><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res"></div><div class="pp_details clearfix"><a class="pp_close" href="#">Close</a><p class="pp_description"></p><div class="pp_nav"><a href="#" class="pp_arrow_previous">Previous</a><p class="currentTextHolder">0'+settings.counter_separator_label+'0</p><a href="#" class="pp_arrow_next">Next</a></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div>';toInject+='<div class="ppt"></div>';$('body').append(toInject);$('div.pp_overlay').css('opacity',0);$pp_pic_holder=$('.pp_pic_holder');$ppt=$('.ppt');$('div.pp_overlay').css('height',$(document).height()).hide().bind('click',function(){if(!settings.modal)
$.prettyPhoto.close();});$('a.pp_close').bind('click',function(){$.prettyPhoto.close();return false;});$('a.pp_expand').bind('click',function(){$this=$(this);if($this.hasClass('pp_expand')){$this.removeClass('pp_expand').addClass('pp_contract');doresize=false;}else{$this.removeClass('pp_contract').addClass('pp_expand');doresize=true;};_hideContent();$pp_pic_holder.find('.pp_hoverContainer, .pp_details').fadeOut(settings.animationSpeed);$pp_pic_holder.find('#pp_full_res').fadeOut(settings.animationSpeed,function(){$.prettyPhoto.open(images,titles,descriptions);});return false;});$pp_pic_holder.find('.pp_previous, .pp_arrow_previous').bind('click',function(){$.prettyPhoto.changePage('previous');return false;});$pp_pic_holder.find('.pp_next, .pp_arrow_next').bind('click',function(){$.prettyPhoto.changePage('next');return false;});$pp_pic_holder.find('.pp_hoverContainer').css({'margin-left':settings.padding/2});};};function grab_param(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);if(results==null)
return"";else
return results[1];}})(jQuery);
//pretty photo

