var GSI_URL_BASKET = "/ES/bag/?partner=5312";var GSI_STOCK_CHECK_OFF = false;var GSI_CATALOG_SWF_PATH = "/img/icc/PEAK/brand_images/swf/";var GSI_LOGIN_WELCOME_URL = "https://icc.production.gsicommerce.eu/ES/login/?partner=5312";var GSI_CATALOG_IMG_PATH = "http://static.peakperformance-store.com/static/img/catalog/PEAK/";var GSI_APP_IMG_PATH = "http://static.peakperformance-store.com/static/PEAK/img/";var GSI_DictEntries = {"widgets":{"notify_me_re_email":"Re-enter Email:","minicart_added_to_cart":"added to bag","minicart_cart_is_empty":"shopping bag","minicart_error":"Opsss...there has been an error and the item hasn't been added correctly to the cart.\r\n Please try it again.","minicart_items_in_cart":"shopping bag:","minicart_loading":"loading minicart","rvp_title":"Where You've Been","xsellsbox_title":"Things We Like","notify_me_email":"Email address:","notifyme_subscription_already_exists":"You have already applied for notifications to this product.","notifyme_success":"Thank you. Your notification subscription has been completed.","notifyme_text":"Please enter your email address and we will notify you when this product becomes available.","notifyme_error_mismatch_emails":"Please verify the emails as they don't match.","notify_no_subscription_type":"The subscription type is not valid.","notifyme_error_invalid_mail":"The email address entered is invalid.","notifyme_heading":"Notify Me","notifyme_in_stock":"The item is in stock","notifyme_item_sku_not_found":"The product could not be found. Plese, try again later.","notifyme_loading":"Loading...","notifyme_no_subscription_type":"There has been an error. Please try again later."},"property_selector":{"SIZE_selector":"Size","COLOR":"Color","FIT":"Fit","QUANTITY":"Quantity","SIZE":"size","WIDTH":"Width","category":"category","collection":"collection","pcolor":"color","qty":"QTY","quantity":"Quantity","social_group":"type","sport":"sport","technology":"technology","FIT_selector":"Fit","gender":"Gender"},"item":{"details":"details","feature_expert_tips":"Expert Tips","feature_fabric":"Fabric","feature_fabric_care":"Fabric Care &amp; Washing","feature_technology":"Material","feature_uses":"Uses","filter_by":"filter by:","in_stock":"in stock","item":"items","material_guide_intro":"The rate of technological development in our society is enormous. Our branch of industry is also being affected by rapid changes. New materials, new technology, and new designs have given us very efficient and advanced garments for practically all areas of use. The new technology and materials create a number of new technical expressions and brand names, which have made the market difficult to navigate for all those involved. In order to sort out some concepts and describe how Peak Performance uses and relates to new technology and materials, we have put together this information for our associates and customers.","material_guide_title":"Material guide","not_available":"not available","out_of_stock":"out of stock","play_video":"Play Video","qty":"qty","read_more":"read more","select_property":"Please select a","sizing_chart":"view sizing chart","zoom":"Zoom","print":"Print","twitter":"Twitter","facebook":"Facebook","notEnoughStock":"Please select a lower quantity","digg":"Digg","delicious":"Delicious"},"search":{"clear_all":"Clear All","clear_selection":"Clear selection","filter_by":"Filter by","filter_results":"Filters:","items_found":"items","items_per_page":"Items per page","most_bought":"Top Sellers","no_results_found":"No Results Found","none":"none","price":"price","product_number":"product number","product_search":"product search","results":"results","returned":"returned","search_results":"search results","search_tips_list":"<ul>\r\n <li>Double check the spelling<\/li>\r\n <li>Limit the search to one or two terms.<\/li>\r\n <li>Try limiting your search to one or two more general terms.<br\/>This will likely lead to similar and related products.<\/li> \r\n<\/ul>","search_tips_title02":"Search tips &amp; suggestions","sort_by":"sort by","tips_title":"Try a new search:","top_rated":"Top Rated","top_sellers":"top sellers","your_search":"Your search","your_search_for":"Your search for","your_search_results":"Search results"},"select":{"please_choose":"Please choose","price_ascending":"Price ascending","price_descending":"Price descending","select_below":"please select below","select_quantity":"Quantity","select_size":"Please select a size","view_all":"View all","price_asc":"Price ascending","price_desc":"Price descending"},"shared":{"about_company":"Our company","back":"back to previous page","copyright":"\u00a9 2009 Peak Performance","header_bg":"bg_header.jpg","item":"style","items":"items","more_colours":"more colours","next":"Next","noscript_text":"<p>We will not be able to serve you properly with Javascript disabled in your browser.<\/p>\r\n<p>Please enable Javascript support in your browser and refresh this page before you continue.<\/p>\r\n<dl>\r\n <dt>Firefox<\/dt>\r\n <dd>Click in the upper menu on Edit \/ Options. Here choose Content, Enable JavaScript and click OK.<\/dd>\r\n <dt>Internet Explorer<\/dt>\r\n <dd>Click in the upper menu on Tools \/ Internet Options.<br \/>\r\n  There click at the menu Security either on Medium, or choose Custom Level and then activate below Scripting the point Enable Active Scripting. Confirm by clicking OK.<\/dd>\r\n <dt>Mozilla<\/dt>\r\n <dd>Click in the upper menu on Edit \/ Preferences. At Advanced \/ Scripts &amp; Plugins chooseNavigator. Now click on OK.<\/dd>\r\n<\/dl>","noscript_title":"Oops, Javascript is disabled in your browser!","previous":"Previous","previous_page":"Previous page","print":"Print Receipt","thank_you":"thank you","you_are_in":"You are in the","your_details":"your details","print_order_summary":"Print Order Summary"},"colors":{"114":"Beige","18T":"Twill Beige","28V":"Night Sky","370":"Seaway","04X":"Pewter","04Y":"Steel Grey","050":"Black","05B":"Barley","05C":"Oak Beige","089":"White","099":"Offwhite","11G":"Brown","189":"Burnt Umbra","18F":"Almond","18S":"Java Brown","19Q":"Winter Beige","23E":"Thunder Blue","24X":"Waterfall","24Y":"Himalayan Blue","28U":"Horizon Blue","28X":"Arctic Blue","28Y":"Mist Blue","32b":"Caribbean Sea","363":"Dive","45D":"Lt. Lime","45Q":"Olive Green","4AU":"Wood Green","4AV":"Vibrant Green","4AY":"Frosty Spruce","53Y":"Bright Red","57E":"Bordeaux","59A":"Simply Red","59U":"Super Pink","5d4":"Lumber Red","60N":"Blossom Pink","64J":"Lavender","71T":"Sunny Lime","82N":"Pumpkin","82P":"Burnt Orange","903":"Dive\/Offwhite\/Beige Pattern","905":"White\/Lightblue Pattern","913":"Black\/Granite\/Offwhite Pattern","925":"Yellow\/Black Pattern\t!eol","926":"Offwhite Check","927":"Pink\/Black Pattern","933":"Black\/Green Pattern","944":"White\/Grey\/Lightblue Pattern","945":"Blue\/White Stripes","948":"Blue\/Lightblue\/White Check","970":"Blue\/White Pattern","971":"Black\/Grey Pattern","987":"Blue\/Grey\/White Stripes","993":"Offwhite3","D14":"Blue Denim","M03":"Med Grey Mel","M08":"Grey Mel","D18":"Grey Denim","D39":"Dark Denim","S07":"Granite","S08":"Ice Blue","S09":"Glacier Lake","S10":"Signal Orange"},"availability":{"availability":"Availability","in_stock":"In stock","out_of_stock":"out of stock","x_in_stock":"x in stock"},"JSAPI":{"lightbox_ourFriends":":NYRO_WIDTH=730:NYRO_HEIGHT=604","telesales_imageSize":"large","tooltip_formCountry":"width=200&amp;height=70","tooltip_formMobilePhone":"width=200&amp;height=70"}};var GSI_PartnerCurrency = {"default":{"decSep":",","thsep":".","pos":"R","numdecs":"2","sym":"&euro;","sepSpace":" "}};if(!this.JSON)JSON=function(){function f(n){return n<10?'0'+n:n};Date.prototype.toJSON=function(){return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z'};var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep
function quote(string){return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"':'"'+string+'"'}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function')value=value.toJSON(key);if(typeof rep==='function')value=rep.call(holder,key,value);switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value)return'null';gap+=indent;partial=[];if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))){length=value.length;for(i=0;i<length;i+=1)partial[i]=str(i,value)||'null';v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v};if(typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value,rep);if(v)partial.push(quote(k)+(gap?': ':':')+v)}}}else for(k in value){v=str(k,value,rep);if(v)partial.push(quote(k)+(gap?': ':':')+v)};v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v}};return{stringify:function(value,replacer,space){var i;gap='';indent='';if(space)if(typeof space==='number'){for(i=0;i<space;i+=1)indent+=' '}else if(typeof space==='string')indent=space;if(!replacer){rep=function(key,value){if(!Object.hasOwnProperty.call(this,key))return undefined;return value}}else if(typeof replacer==='function'||(typeof replacer==='object'&&typeof replacer.length==='number')){rep=replacer}else throw new Error('JSON.stringify');return str('',{'':value})},parse:function(text,reviver){var j
function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object')for(k in value)if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else delete value[k]};return reviver.call(holder,key,value)};if(/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j};throw new SyntaxError('JSON.parse')},quote:quote}}()
var GSI_CATALOG_IMG_PATH=GSI_CATALOG_IMG_PATH?GSI_CATALOG_IMG_PATH:"/static/img/catalog/",GSI_APP_IMG_PATH=GSI_APP_IMG_PATH?GSI_APP_IMG_PATH:"/static/img/",GSI_SERVICE_PATH='/v1/',GSI_DEBUG=false,GSI_PLACEHOLDER_ID_ITEM_DYN='item-dyn',GSI_PLACEHOLDER_ID_XPRESSITEM_DYN='express-shop-dyn'
GSI_DEBUG=false;var GSI_LOADER_IMAGE_BIG=GSI_APP_IMG_PATH+'loader_big.gif',GSI_LOADER_IMAGE_MEDIUM=GSI_APP_IMG_PATH+'loader_medium.gif',GSI_LOADER_IMAGE_SMALL=GSI_APP_IMG_PATH+'loader_small.gif'
/*
 * nyroModal - jQuery Plugin
 * http://nyromodal.nyrodev.com
 *
 * Copyright (c) 2008 Cedric Nirousset (nyrodev.com)
 * Licensed under the MIT license
 *
 * $Date: 2009/08/26 09:57:40 $
 * $version: 1.5.1
 */
jQuery(function($){var userAgent=navigator.userAgent.toLowerCase();var browserVersion=(userAgent.match(/.+(?:rv|webkit|khtml|opera|msie)[\/: ]([\d.]+)/)||[0,'0'])[1];var isIE6=(/msie/.test(userAgent)&&!/opera/.test(userAgent)&&parseInt(browserVersion)<7&&!window.XMLHttpRequest);var body=$('body');var currentSettings;var shouldResize=false;var gallery={};var fixFF=false;var contentElt;var contentEltLast;var modal={started:false,ready:false,dataReady:false,anim:false,animContent:false,loadingShown:false,transition:false,resizing:false,closing:false,error:false,blocker:null,blockerVars:null,full:null,bg:null,loading:null,tmp:null,content:null,wrapper:null,contentWrapper:null,scripts:new Array(),scriptsShown:new Array()};var resized={width:false,height:false,windowResizing:false};var initSettingsSize={width:null,height:null,windowResizing:true};var windowResizeTimeout;$.fn.nyroModal=function(settings){if(!this)return false;return this.each(function(){var me=$(this);if(this.nodeName.toLowerCase()=='form'){me.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(me.data('nyroModalprocessing'))return true;if(this.enctype=='multipart/form-data'){processModal($.extend(settings,{from:this}));return true}e.preventDefault();processModal($.extend(settings,{from:this}));return false})}else{me.unbind('click.nyroModal').bind('click.nyroModal',function(e){e.preventDefault();processModal($.extend(settings,{from:this}));return false})}})};$.fn.nyroModalManual=function(settings){if(!this.length)processModal(settings);return this.each(function(){processModal($.extend(settings,{from:this}))})};$.nyroModalManual=function(settings){processModal(settings)};$.nyroModalSettings=function(settings,deep1,deep2){setCurrentSettings(settings,deep1,deep2);if(!deep1&&modal.started){if(modal.bg&&settings.bgColor)currentSettings.updateBgColor(modal,currentSettings,function(){});if(modal.contentWrapper&&settings.title)setTitle();if(!modal.error&&(settings.windowResizing||(!modal.resizing&&(('width'in settings&&settings.width==currentSettings.width)||('height'in settings&&settings.height==currentSettings.height))))){modal.resizing=true;if(modal.contentWrapper)calculateSize(true);if(modal.contentWrapper&&modal.contentWrapper.is(':visible')&&!modal.animContent){if(fixFF)modal.content.css({position:''});currentSettings.resize(modal,currentSettings,function(){currentSettings.windowResizing=false;modal.resizing=false;if(fixFF)modal.content.css({position:'fixed'});if($.isFunction(currentSettings.endResize))currentSettings.endResize(modal,currentSettings)})}}}};$.nyroModalRemove=function(){removeModal()};$.nyroModalNext=function(){var link=getGalleryLink(1);if(link)return link.nyroModalManual(getCurrentSettingsNew());return false};$.nyroModalPrev=function(){var link=getGalleryLink(-1);if(link)return link.nyroModalManual(getCurrentSettingsNew());return false};$.fn.nyroModal.settings={debug:false,blocker:false,modal:false,type:'',forceType:null,from:'',hash:'',processHandler:null,selIndicator:'nyroModalSel',formIndicator:'nyroModal',content:null,bgColor:'#000000',ajax:{},swf:{wmode:'transparent'},width:null,height:null,minWidth:400,minHeight:300,resizable:true,autoSizable:true,padding:25,regexImg:'[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$',addImageDivTitle:false,defaultImgAlt:'Image',setWidthImgTitle:true,ltr:true,gallery:null,galleryLinks:'<a href="#" class="nyroModalPrev">Prev</a><a href="#"  class="nyroModalNext">Next</a>',galleryCounts:galleryCounts,zIndexStart:100,css:{bg:{position:'absolute',overflow:'hidden',top:0,left:0,height:'100%',width:'100%'},wrapper:{position:'absolute',top:'50%',left:'50%'},wrapper2:{},content:{overflow:'auto'},loading:{position:'absolute',top:'50%',left:'50%',marginTop:'-50px',marginLeft:'-50px'}},wrap:{div:'<div class="wrapper"></div>',ajax:'<div class="wrapper"></div>',form:'<div class="wrapper"></div>',formData:'<div class="wrapper"></div>',image:'<div class="wrapperImg"></div>',swf:'<div class="wrapperSwf"></div>',iframe:'<div class="wrapperIframe"></div>',iframeForm:'<div class="wrapperIframe"></div>',manual:'<div class="wrapper"></div>'},closeButton:'<a href="#" class="nyroModalClose" id="closeBut" title="close">Close</a>',title:null,titleFromIframe:true,openSelector:'.nyroModal',closeSelector:'.nyroModalClose',contentLoading:'<a href="#" class="nyroModalClose">Cancel</a>',errorClass:'error',contentError:'The requested content cannot be loaded.<br />Please try again later.<br /><a href="#" class="nyroModalClose">Close</a>',handleError:null,showBackground:showBackground,hideBackground:hideBackground,endFillContent:null,showContent:showContent,endShowContent:null,beforeHideContent:null,hideContent:hideContent,showTransition:showTransition,hideTransition:hideTransition,showLoading:showLoading,hideLoading:hideLoading,resize:resize,endResize:null,updateBgColor:updateBgColor,endRemove:null};function processModal(settings){if(modal.loadingShown||modal.transition||modal.anim)return;debug('processModal');modal.started=true;setDefaultCurrentSettings(settings);if(!modal.full)modal.blockerVars=modal.blocker=null;modal.error=false;modal.closing=false;modal.dataReady=false;modal.scripts=new Array();modal.scriptsShown=new Array();currentSettings.type=fileType();if(currentSettings.forceType){if(!currentSettings.content)currentSettings.from=true;currentSettings.type=currentSettings.forceType;currentSettings.forceType=null}if($.isFunction(currentSettings.processHandler))currentSettings.processHandler(currentSettings);var from=currentSettings.from;var url=currentSettings.url;initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height;if(currentSettings.type=='swf'){setCurrentSettings({overflow:'hidden'},'css','content');currentSettings.content='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+currentSettings.width+'" height="'+currentSettings.height+'"><param name="movie" value="'+url+'"></param>';var tmp='';$.each(currentSettings.swf,function(name,val){currentSettings.content+='<param name="'+name+'" value="'+val+'"></param>';tmp+=' '+name+'="'+val+'"'});currentSettings.content+='<embed src="'+url+'" type="application/x-shockwave-flash" width="'+currentSettings.width+'" height="'+currentSettings.height+'"'+tmp+'></embed></object>'}if(from){var jFrom=$(from).blur();if(currentSettings.type=='form'){var data=$(from).serializeArray();data.push({name:currentSettings.formIndicator,value:1});if(currentSettings.selector)data.push({name:currentSettings.selIndicator,value:currentSettings.selector.substring(1)});$.ajax($.extend({},currentSettings.ajax,{url:url,data:data,type:jFrom.attr('method')?jFrom.attr('method'):'get',success:ajaxLoaded,error:loadingError}));debug('Form Ajax Load: '+jFrom.attr('action'));showModal()}else if(currentSettings.type=='formData'){initModal();jFrom.attr('target','nyroModalIframe');jFrom.attr('action',url);jFrom.prepend('<input type="hidden" name="'+currentSettings.formIndicator+'" value="1" />');if(currentSettings.selector)jFrom.prepend('<input type="hidden" name="'+currentSettings.selIndicator+'" value="'+currentSettings.selector.substring(1)+'" />');modal.tmp.html('<iframe frameborder="0" hspace="0" name="nyroModalIframe" src="javascript:false;"></iframe>');$('iframe',modal.tmp).css({width:currentSettings.width,height:currentSettings.height}).error(loadingError).load(formDataLoaded);debug('Form Data Load: '+jFrom.attr('action'));showModal();showContentOrLoading()}else if(currentSettings.type=='image'){debug('Image Load: '+url);var title=jFrom.attr('title')||currentSettings.defaultImgAlt;initModal();modal.tmp.html('<img id="nyroModalImg" />').find('img').attr('alt',title);modal.tmp.css({lineHeight:0});$('img',modal.tmp).error(loadingError).load(function(){debug('Image Loaded: '+this.src);$(this).unbind('load');var w=modal.tmp.width();var h=modal.tmp.height();modal.tmp.css({lineHeight:''});resized.width=w;resized.height=h;setCurrentSettings({width:w,height:h,imgWidth:w,imgHeight:h});initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({overflow:'hidden'},'css','content');modal.dataReady=true;if(modal.loadingShown||modal.transition)showContentOrLoading()}).attr('src',url);showModal()}else if(currentSettings.type=='iframeForm'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:false;" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Form Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal()}else if(currentSettings.type=='iframe'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:false;" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal()}else if(currentSettings.type){debug('Content: '+currentSettings.type);initModal();modal.tmp.html(currentSettings.content);var w=modal.tmp.width();var h=modal.tmp.height();var div=$(currentSettings.type);if(div.length){setCurrentSettings({type:'div'});w=div.width();h=div.height();if(contentElt)contentEltLast=contentElt;contentElt=div;modal.tmp.append(div.contents())}initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({width:w,height:h});if(modal.tmp.html())modal.dataReady=true;else loadingError();if(!modal.ready)showModal();else endHideContent()}else{debug('Ajax Load: '+url);setCurrentSettings({type:'ajax'});var data=currentSettings.ajax.data||{};if(currentSettings.selector){if(typeof data=="string"){data+='&'+currentSettings.selIndicator+'='+currentSettings.selector.substring(1)}else{data[currentSettings.selIndicator]=currentSettings.selector.substring(1)}}$.ajax($.extend(true,currentSettings.ajax,{url:url,success:ajaxLoaded,error:loadingError,data:data}));showModal()}}else if(currentSettings.content){debug('Content: '+currentSettings.type);setCurrentSettings({type:'manual'});initModal();modal.tmp.html($('<div/>').html(currentSettings.content).contents());if(modal.tmp.html())modal.dataReady=true;else loadingError();showModal()}else{}}function setDefaultCurrentSettings(settings){debug('setDefaultCurrentSettings');currentSettings=$.extend(true,{},$.fn.nyroModal.settings,settings);currentSettings.selector='';currentSettings.borderW=0;currentSettings.borderH=0;currentSettings.resizable=true;setMargin()}function setCurrentSettings(settings,deep1,deep2){if(modal.started){if(deep1&&deep2){$.extend(true,currentSettings[deep1][deep2],settings)}else if(deep1){$.extend(true,currentSettings[deep1],settings)}else{if(modal.animContent){if('width'in settings){if(!modal.resizing){settings.setWidth=settings.width;shouldResize=true}delete settings['width']}if('height'in settings){if(!modal.resizing){settings.setHeight=settings.height;shouldResize=true}delete settings['height']}}$.extend(true,currentSettings,settings)}}else{if(deep1&&deep2){$.extend(true,$.fn.nyroModal.settings[deep1][deep2],settings)}else if(deep1){$.extend(true,$.fn.nyroModal.settings[deep1],settings)}else{$.extend(true,$.fn.nyroModal.settings,settings)}}}function setMarginScroll(){if(isIE6&&!modal.blocker){if(document.documentElement){currentSettings.marginScrollLeft=document.documentElement.scrollLeft;currentSettings.marginScrollTop=document.documentElement.scrollTop}else{currentSettings.marginScrollLeft=document.body.scrollLeft;currentSettings.marginScrollTop=document.body.scrollTop}}else{currentSettings.marginScrollLeft=0;currentSettings.marginScrollTop=0}}function setMargin(){setMarginScroll();currentSettings.marginLeft=-(currentSettings.width+currentSettings.borderW)/2;currentSettings.marginTop=-(currentSettings.height+currentSettings.borderH)/2;if(!modal.blocker){currentSettings.marginLeft+=currentSettings.marginScrollLeft;currentSettings.marginTop+=currentSettings.marginScrollTop}}function setMarginLoading(){setMarginScroll();var outer=getOuter(modal.loading);currentSettings.marginTopLoading=-(modal.loading.height()+outer.h.border+outer.h.padding)/2;currentSettings.marginLeftLoading=-(modal.loading.width()+outer.w.border+outer.w.padding)/2;if(!modal.blocker){currentSettings.marginLefttLoading+=currentSettings.marginScrollLeft;currentSettings.marginTopLoading+=currentSettings.marginScrollTop}}function setTitle(){var title=$('h1#nyroModalTitle',modal.contentWrapper);if(title.length)title.text(currentSettings.title);else modal.contentWrapper.prepend('<h1 id="nyroModalTitle">'+currentSettings.title+'</h1>')}function initModal(){debug('initModal');if(!modal.full){if(currentSettings.debug)setCurrentSettings({color:'white'},'css','bg');var full={zIndex:currentSettings.zIndexStart,position:'fixed',top:0,left:0,width:'100%',height:'100%'};var contain=body;var iframeHideIE='';if(currentSettings.blocker){modal.blocker=contain=$(currentSettings.blocker);var pos=modal.blocker.offset();var w=modal.blocker.outerWidth();var h=modal.blocker.outerHeight();if(isIE6){setCurrentSettings({height:'100%',width:'100%',top:0,left:0},'css','bg')}modal.blockerVars={top:pos.top,left:pos.left,width:w,height:h};var plusTop=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderTopWidth'));var plusLeft=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderLeftWidth'));full={position:'absolute',top:pos.top+plusTop,left:pos.left+plusLeft,width:w,height:h}}else if(isIE6){body.css({height:body.height()+'px',width:body.width()+'px',position:'static',overflow:'hidden'});$('html').css({overflow:'hidden'});setCurrentSettings({css:{bg:{position:'absolute',zIndex:currentSettings.zIndexStart+1,height:'110%',width:'110%',top:currentSettings.marginScrollTop+'px',left:currentSettings.marginScrollLeft+'px'},wrapper:{zIndex:currentSettings.zIndexStart+2},loading:{zIndex:currentSettings.zIndexStart+3}}});iframeHideIE=$('<iframe id="nyroModalIframeHideIe" src="javascript:false;"></iframe>').css($.extend({},currentSettings.css.bg,{opacity:0,zIndex:50,border:'none'}))}contain.append($('<div id="nyroModalFull"><div id="nyroModalBg"></div><div id="nyroModalWrapper"><div id="nyroModalContent"></div></div><div id="nyrModalTmp"></div><div id="nyroModalLoading"></div></div>').hide());modal.full=$('#nyroModalFull').css(full).show();modal.bg=$('#nyroModalBg').css($.extend({backgroundColor:currentSettings.bgColor},currentSettings.css.bg)).before(iframeHideIE);if(!currentSettings.modal)modal.bg.click(removeModal);modal.loading=$('#nyroModalLoading').css(currentSettings.css.loading).hide();modal.contentWrapper=$('#nyroModalWrapper').css(currentSettings.css.wrapper).hide();modal.content=$('#nyroModalContent');modal.tmp=$('#nyrModalTmp').hide();if($.isFunction($.fn.mousewheel)){modal.content.mousewheel(function(e,d){var elt=modal.content.get(0);if((d>0&&elt.scrollTop==0)||(d<0&&elt.scrollHeight-elt.scrollTop==elt.clientHeight)){e.preventDefault();e.stopPropagation()}})}$(document).bind('keydown.nyroModal',keyHandler);modal.content.css({width:'auto',height:'auto'});modal.contentWrapper.css({width:'auto',height:'auto'});if(!currentSettings.blocker){$(window).bind('resize.nyroModal',function(){window.clearTimeout(windowResizeTimeout);windowResizeTimeout=window.setTimeout(windowResizeHandler,200)})}}}function windowResizeHandler(){$.nyroModalSettings(initSettingsSize)}function showModal(){debug('showModal');if(!modal.ready){initModal();modal.anim=true;currentSettings.showBackground(modal,currentSettings,endBackground)}else{modal.anim=true;modal.transition=true;currentSettings.showTransition(modal,currentSettings,function(){endHideContent();modal.anim=false;showContentOrLoading()})}}function keyHandler(e){if(e.keyCode==27){if(!currentSettings.modal)removeModal()}else if(currentSettings.gallery&&modal.ready&&modal.dataReady&&!modal.anim&&!modal.transition){if(e.keyCode==39||e.keyCode==40){e.preventDefault();$.nyroModalNext();return false}else if(e.keyCode==37||e.keyCode==38){e.preventDefault();$.nyroModalPrev();return false}}}function fileType(){var from=currentSettings.from;var url;if(from&&from.nodeName){var jFrom=$(from);url=jFrom.attr(from.nodeName.toLowerCase()=='form'?'action':'href');if(!url)url=location.href.substring(window.location.host.length+7);currentSettings.url=url;if(jFrom.attr('rev')=='modal')currentSettings.modal=true;currentSettings.title=jFrom.attr('title');if(from&&from.rel&&from.rel.toLowerCase()!='nofollow'){var indexSpace=from.rel.indexOf(' ');currentSettings.gallery=indexSpace>0?from.rel.substr(0,indexSpace):from.rel}var imgType=imageType(url,from);if(imgType)return imgType;if(isSwf(url))return'swf';var iframe=false;if(from.target&&from.target.toLowerCase()=='_blank'||(from.hostname&&from.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,''))){iframe=true}if(from.nodeName.toLowerCase()=='form'){if(iframe)return'iframeForm';setCurrentSettings(extractUrlSel(url));if(jFrom.attr('enctype')=='multipart/form-data')return'formData';return'form'}if(iframe)return'iframe'}else{url=currentSettings.url;if(!currentSettings.content)currentSettings.from=true;if(!url)return null;if(isSwf(url))return'swf';var reg1=new RegExp("^http://","g");if(url.match(reg1))return'iframe'}var imgType=imageType(url,from);if(imgType)return imgType;var tmp=extractUrlSel(url);setCurrentSettings(tmp);if(!tmp.url)return tmp.selector}function imageType(url,from){var image=new RegExp(currentSettings.regexImg,'i');if(image.test(url)){return'image'}}function isSwf(url){var swf=new RegExp('[^\.]\.(swf)\s*$','i');return swf.test(url)}function extractUrlSel(url){var ret={url:null,selector:null};if(url){var hash=getHash(url);var hashLoc=getHash(window.location.href);var curLoc=window.location.href.substring(0,window.location.href.length-hashLoc.length);var req=url.substring(0,url.length-hash.length);if(req==curLoc||req==$('base').attr('href')){ret.selector=hash}else{ret.url=req;ret.selector=hash}}return ret}function loadingError(){debug('loadingError');modal.error=true;if(!modal.ready)return;if($.isFunction(currentSettings.handleError))currentSettings.handleError(modal,currentSettings);modal.loading.addClass(currentSettings.errorClass).html(currentSettings.contentError);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();modal.loading.css({marginTop:currentSettings.marginTopLoading+'px',marginLeft:currentSettings.marginLeftLoading+'px'})}function fillContent(){debug('fillContent');if(!modal.tmp.html())return;modal.content.html(modal.tmp.contents());modal.tmp.empty();wrapContent();if(currentSettings.type=='iframeForm'){$(currentSettings.from).attr('target','nyroModalIframe').data('nyroModalprocessing',1).submit().attr('target','_blank').removeData('nyroModalprocessing')}if(!currentSettings.modal)modal.wrapper.prepend(currentSettings.closeButton);if($.isFunction(currentSettings.endFillContent))currentSettings.endFillContent(modal,currentSettings);modal.content.append(modal.scripts);$(currentSettings.closeSelector,modal.contentWrapper).unbind('click.nyroModal').bind('click.nyroModal',removeModal);$(currentSettings.openSelector,modal.contentWrapper).nyroModal(getCurrentSettingsNew())}function getCurrentSettingsNew(){var currentSettingsNew=$.extend(true,{},currentSettings);if(resized.width)currentSettingsNew.width=null;else currentSettingsNew.width=initSettingsSize.width;if(resized.height)currentSettingsNew.height=null;else currentSettingsNew.height=initSettingsSize.height;currentSettingsNew.css.content.overflow='auto';return currentSettingsNew}function wrapContent(){debug('wrapContent');var wrap=$(currentSettings.wrap[currentSettings.type]);modal.content.append(wrap.children().remove());modal.contentWrapper.wrapInner(wrap);if(currentSettings.gallery){modal.content.append(currentSettings.galleryLinks);gallery.links=$('[rel*="'+currentSettings.gallery+'"]');gallery.index=gallery.links.index(currentSettings.from);if(currentSettings.galleryCounts&&$.isFunction(currentSettings.galleryCounts))currentSettings.galleryCounts(gallery.index+1,gallery.links.length,modal,currentSettings);var currentSettingsNew=getCurrentSettingsNew();var linkPrev=getGalleryLink(-1);if(linkPrev){var prev=$('.nyroModalPrev',modal.contentWrapper).attr('href',linkPrev.attr('href')).click(function(e){e.preventDefault();$.nyroModalPrev();return false});if(isIE6&&currentSettings.type=='swf'){prev.before($('<iframe id="nyroModalIframeHideIeGalleryPrev" src="javascript:false;"></iframe>').css({position:prev.css('position'),top:prev.css('top'),left:prev.css('left'),width:prev.width(),height:prev.height(),opacity:0,border:'none'}))}}else{$('.nyroModalPrev',modal.contentWrapper).remove()}var linkNext=getGalleryLink(1);if(linkNext){var next=$('.nyroModalNext',modal.contentWrapper).attr('href',linkNext.attr('href')).click(function(e){e.preventDefault();$.nyroModalNext();return false});if(isIE6&&currentSettings.type=='swf'){next.before($('<iframe id="nyroModalIframeHideIeGalleryNext" src="javascript:false;"></iframe>').css($.extend({},{position:next.css('position'),top:next.css('top'),left:next.css('left'),width:next.width(),height:next.height(),opacity:0,border:'none'})))}}else{$('.nyroModalNext',modal.contentWrapper).remove()}}calculateSize()}function getGalleryLink(dir){if(currentSettings.gallery){if(!currentSettings.ltr)dir*=-1;var index=gallery.index+dir;if(index>=0&&index<gallery.links.length)return gallery.links.eq(index)}return false}function calculateSize(resizing){debug('calculateSize');modal.wrapper=modal.contentWrapper.children('div:first');resized.width=false;resized.height=false;if(false&&!currentSettings.windowResizing){initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height}if(currentSettings.autoSizable&&(!currentSettings.width||!currentSettings.height)){modal.contentWrapper.css({opacity:0,width:'auto',height:'auto'}).show();var tmp={width:'auto',height:'auto'};if(currentSettings.width){tmp.width=currentSettings.width}else if(currentSettings.type=='iframe'){tmp.width=currentSettings.minWidth}if(currentSettings.height){tmp.height=currentSettings.height}else if(currentSettings.type=='iframe'){tmp.height=currentSettings.minHeight}modal.content.css(tmp);if(!currentSettings.width){currentSettings.width=modal.content.outerWidth(true);resized.width=true}if(!currentSettings.height){currentSettings.height=modal.content.outerHeight(true);resized.height=true}modal.contentWrapper.css({opacity:1});if(!resizing)modal.contentWrapper.hide()}if(currentSettings.type!='image'&&currentSettings.type!='swf'){currentSettings.width=Math.max(currentSettings.width,currentSettings.minWidth);currentSettings.height=Math.max(currentSettings.height,currentSettings.minHeight)}var outerWrapper=getOuter(modal.contentWrapper);var outerWrapper2=getOuter(modal.wrapper);var outerContent=getOuter(modal.content);var tmp={content:{width:currentSettings.width,height:currentSettings.height},wrapper2:{width:currentSettings.width+outerContent.w.total,height:currentSettings.height+outerContent.h.total},wrapper:{width:currentSettings.width+outerContent.w.total+outerWrapper2.w.total,height:currentSettings.height+outerContent.h.total+outerWrapper2.h.total}};if(currentSettings.resizable){var maxHeight=modal.blockerVars?modal.blockerVars.height:$(window).height()-outerWrapper.h.border-(tmp.wrapper.height-currentSettings.height);var maxWidth=modal.blockerVars?modal.blockerVars.width:$(window).width()-outerWrapper.w.border-(tmp.wrapper.width-currentSettings.width);maxHeight-=currentSettings.padding*2;maxWidth-=currentSettings.padding*2;if(tmp.content.height>maxHeight||tmp.content.width>maxWidth){if(currentSettings.type=='image'||currentSettings.type=='swf'){var useW=currentSettings.imgWidth?currentSettings.imgWidth:currentSettings.width;var useH=currentSettings.imgHeight?currentSettings.imgHeight:currentSettings.height;var diffW=tmp.content.width-useW;var diffH=tmp.content.height-useH;if(diffH<0)diffH=0;if(diffW<0)diffW=0;var calcH=maxHeight-diffH;var calcW=maxWidth-diffW;var ratio=Math.min(calcH/useH,calcW/useW);calcW=Math.floor(useW*ratio);calcH=Math.floor(useH*ratio);tmp.content.height=calcH+diffH;tmp.content.width=calcW+diffW}else{tmp.content.height=Math.min(tmp.content.height,maxHeight);tmp.content.width=Math.min(tmp.content.width,maxWidth)}tmp.wrapper2={width:tmp.content.width+outerContent.w.total,height:tmp.content.height+outerContent.h.total};tmp.wrapper={width:tmp.content.width+outerContent.w.total+outerWrapper2.w.total,height:tmp.content.height+outerContent.h.total+outerWrapper2.h.total}}}if(currentSettings.type=='swf'){$('object, embed',modal.content).attr('width',tmp.content.width).attr('height',tmp.content.height)}else if(currentSettings.type=='image'){$('img',modal.content).css({width:tmp.content.width,height:tmp.content.height})}modal.content.css($.extend({},tmp.content,currentSettings.css.content));modal.wrapper.css($.extend({},tmp.wrapper2,currentSettings.css.wrapper2));if(!resizing)modal.contentWrapper.css($.extend({},tmp.wrapper,currentSettings.css.wrapper));if(currentSettings.type=='image'&&currentSettings.addImageDivTitle){$('img',modal.content).removeAttr('alt');var divTitle=$('div',modal.content);if(currentSettings.title!=currentSettings.defaultImgAlt&&currentSettings.title){if(divTitle.length==0){divTitle=$('<div>'+currentSettings.title+'</div>');modal.content.append(divTitle)}if(currentSettings.setWidthImgTitle){var outerDivTitle=getOuter(divTitle);divTitle.css({width:(tmp.content.width+outerContent.w.padding-outerDivTitle.w.total)+'px'})}}else if(divTitle.length=0){divTitle.remove()}}if(currentSettings.title)setTitle();tmp.wrapper.borderW=outerWrapper.w.border;tmp.wrapper.borderH=outerWrapper.h.border;setCurrentSettings(tmp.wrapper);setMargin()}function removeModal(e){debug('removeModal');if(e)e.preventDefault();if(modal.full&&modal.ready){$(document).unbind('keydown.nyroModal');if(!currentSettings.blocker)$(window).unbind('resize.nyroModal');modal.ready=false;modal.anim=true;modal.closing=true;if(modal.loadingShown||modal.transition){currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;modal.transition=false;currentSettings.hideBackground(modal,currentSettings,endRemove)})}else{if(fixFF)modal.content.css({position:''});modal.wrapper.css({overflow:'hidden'});modal.content.css({overflow:'hidden'});if($.isFunction(currentSettings.beforeHideContent)){currentSettings.beforeHideContent(modal,currentSettings,function(){currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove)})})}else{currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove)})}}}if(e)return false}function showContentOrLoading(){debug('showContentOrLoading');if(modal.ready&&!modal.anim){if(modal.dataReady){if(modal.tmp.html()){modal.anim=true;if(modal.transition){fillContent();modal.animContent=true;currentSettings.hideTransition(modal,currentSettings,function(){modal.loading.hide();modal.transition=false;modal.loadingShown=false;endShowContent()})}else{currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;fillContent();setMarginLoading();setMargin();modal.animContent=true;currentSettings.showContent(modal,currentSettings,endShowContent)})}}}else if(!modal.loadingShown&&!modal.transition){modal.anim=true;modal.loadingShown=true;if(modal.error)loadingError();else modal.loading.html(currentSettings.contentLoading);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();currentSettings.showLoading(modal,currentSettings,function(){modal.anim=false;showContentOrLoading()})}}}function ajaxLoaded(data){debug('AjaxLoaded: '+this.url);modal.tmp.html(currentSettings.selector?filterScripts($('<div>'+data+'</div>').find(currentSettings.selector).contents()):filterScripts(data));if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading()}else loadingError()}function formDataLoaded(){debug('formDataLoaded');var jFrom=$(currentSettings.from);jFrom.attr('action',jFrom.attr('action')+currentSettings.selector);jFrom.attr('target','');$('input[name='+currentSettings.formIndicator+']',currentSettings.from).remove();var iframe=modal.tmp.children('iframe');var iframeContent=iframe.unbind('load').contents().find(currentSettings.selector||'body').not('script[src]');iframe.attr('src','about:blank');modal.tmp.html(iframeContent.html());if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading()}else loadingError()}function iframeLoaded(){if((window.location.hostname&&currentSettings.url.indexOf(window.location.hostname)>-1)||currentSettings.url.indexOf('http://')){var iframe=$('iframe',modal.full).contents();var tmp={};if(currentSettings.titleFromIframe)tmp.title=iframe.find('title').text();if(!tmp.title){try{tmp.title=iframe.find('title').html()}catch(err){}}var body=iframe.find('body');if(!currentSettings.height&&body.height())tmp.height=body.height();if(!currentSettings.width&&body.width())tmp.width=body.width();$.extend(initSettingsSize,tmp);$.nyroModalSettings(tmp)}}function galleryCounts(nb,total,elts,settings){if(total>1)settings.title+=(settings.title?' - ':'')+nb+'/'+total}function endHideContent(){debug('endHideContent');modal.anim=false;if(contentEltLast){contentEltLast.append(modal.content.contents());contentEltLast=null}else if(contentElt){contentElt.append(modal.content.contents());contentElt=null}modal.content.empty();gallery={};modal.contentWrapper.hide().children().remove().empty().attr('style','').hide();if(modal.closing||modal.transition)modal.contentWrapper.hide();modal.contentWrapper.css(currentSettings.css.wrapper).append(modal.content);showContentOrLoading()}function endRemove(){debug('endRemove');$(document).unbind('keydown',keyHandler);modal.anim=false;modal.full.remove();modal.full=null;if(isIE6){body.css({height:'',width:'',position:'',overflow:''});$('html').css({overflow:''})}if($.isFunction(currentSettings.endRemove))currentSettings.endRemove(modal,currentSettings)}function endBackground(){debug('endBackground');modal.ready=true;modal.anim=false;showContentOrLoading()}function endShowContent(){debug('endShowContent');modal.anim=false;modal.animContent=false;modal.contentWrapper.css({opacity:''});fixFF=/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)&&parseFloat(browserVersion)<1.9&&currentSettings.type!='image';if(fixFF)modal.content.css({position:'fixed'});modal.content.append(modal.scriptsShown);if(currentSettings.type=='iframe')modal.content.find('iframe').attr('src',currentSettings.url);if($.isFunction(currentSettings.endShowContent))currentSettings.endShowContent(modal,currentSettings);if(shouldResize){shouldResize=false;$.nyroModalSettings({width:currentSettings.setWidth,height:currentSettings.setHeight});delete currentSettings['setWidth'];delete currentSettings['setHeight']}if(resized.width)setCurrentSettings({width:null});if(resized.height)setCurrentSettings({height:null})}function getHash(url){if(typeof url=='string'){var hashPos=url.indexOf('#');if(hashPos>-1)return url.substring(hashPos)}return''}function filterScripts(data){if(typeof data=='string')data=data.replace(/<\/?(html|head|body)([^>]*)>/gi,'');var tmp=new Array();$.each($.clean({0:data},this.ownerDocument),function(){if($.nodeName(this,"script")){if(!this.src||$(this).attr('rel')=='forceLoad'){if($(this).attr('rev')=='shown')modal.scriptsShown.push(this);else modal.scripts.push(this)}}else tmp.push(this)});return tmp}function getOuter(elm){elm=elm.get(0);var ret={h:{margin:getCurCSS(elm,'marginTop')+getCurCSS(elm,'marginBottom'),border:getCurCSS(elm,'borderTopWidth')+getCurCSS(elm,'borderBottomWidth'),padding:getCurCSS(elm,'paddingTop')+getCurCSS(elm,'paddingBottom')},w:{margin:getCurCSS(elm,'marginLeft')+getCurCSS(elm,'marginRight'),border:getCurCSS(elm,'borderLeftWidth')+getCurCSS(elm,'borderRightWidth'),padding:getCurCSS(elm,'paddingLeft')+getCurCSS(elm,'paddingRight')}};ret.h.outer=ret.h.margin+ret.h.border;ret.w.outer=ret.w.margin+ret.w.border;ret.h.inner=ret.h.padding+ret.h.border;ret.w.inner=ret.w.padding+ret.w.border;ret.h.total=ret.h.outer+ret.h.padding;ret.w.total=ret.w.outer+ret.w.padding;return ret}function getCurCSS(elm,name){var ret=parseInt($.curCSS(elm,name,true));if(isNaN(ret))ret=0;return ret}function debug(msg){if($.fn.nyroModal.settings.debug||currentSettings&&currentSettings.debug)nyroModalDebug(msg,modal,currentSettings||{})}function showBackground(elts,settings,callback){elts.bg.css({opacity:0}).fadeTo(500,0.75,callback)}function hideBackground(elts,settings,callback){elts.bg.fadeOut(300,callback)}function showLoading(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px',opacity:0}).show().animate({opacity:1},{complete:callback,duration:400})}function hideLoading(elts,settings,callback){callback()}function showContent(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px'}).show().animate({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'},{duration:350,complete:function(){elts.contentWrapper.css({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'}).show();elts.loading.fadeOut(200,callback)}})}function hideContent(elts,settings,callback){elts.contentWrapper.animate({height:'50px',width:'50px',marginTop:(-(25+settings.borderH)/2+settings.marginScrollTop)+'px',marginLeft:(-(25+settings.borderW)/2+settings.marginScrollLeft)+'px'},{duration:350,complete:function(){elts.contentWrapper.hide();callback()}})}function showTransition(elts,settings,callback){elts.loading.css({marginTop:elts.contentWrapper.css('marginTop'),marginLeft:elts.contentWrapper.css('marginLeft'),height:elts.contentWrapper.css('height'),width:elts.contentWrapper.css('width'),opacity:0}).show().fadeTo(400,1,function(){elts.contentWrapper.hide();callback()})}function hideTransition(elts,settings,callback){elts.contentWrapper.hide().css({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px',opacity:1});elts.loading.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:function(){elts.contentWrapper.show();elts.loading.fadeOut(400,function(){elts.loading.hide();callback()})},duration:350})}function resize(elts,settings,callback){elts.contentWrapper.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:callback,duration:400})}function updateBgColor(elts,settings,callback){if(!$.fx.step.backgroundColor){elts.bg.css({backgroundColor:settings.bgColor});callback()}else elts.bg.animate({backgroundColor:settings.bgColor},{complete:callback,duration:400})}$($.fn.nyroModal.settings.openSelector).nyroModal()});function nyroModalDebug(msg,elts,settings){if(elts.full)elts.bg.prepend(msg+'<br />')}
/**
http://nyromodal.nyrodev.com/
	this gives us thickbox functionality where we can influence the setting of each modal through the url.
	the author of nyroModal does not make this default functionality because he does not want to alter the url for this purpose.
	BUT this show how flexible nyrolmodal is because it can be edited to do so quite easily
	author: will caine
**/
$(function() {
	if(jQuery.fn){
		jQuery.fn.nyroModal.settings.processHandler = function(settings) {
			var tar_url = null;
			var surl = settings.url;
			var stype = settings.type;
			
			if(surl){
				tar_url=surl;
			}else{
				//url can be null if an type==iframe, so derive the url some other way
				if(settings.from && settings.from.tagName=='A'){
					tar_url=settings.from.href;
				}
			}
			
			if (tar_url) {
				var args = new Array();
				var usplit=tar_url.split("?");
				//this is used to relocate the bookmark to the end of the url, if i have to rewrite it
				var bkmark_inx=tar_url.indexOf("#");
				if(usplit.length>1){
					usplit = usplit[1].split("&");
					for(x=0; x<usplit.length; x++){
						arrsplit=usplit[x].split("=");
						if(arrsplit[1]){
							args[arrsplit[0].toUpperCase()]=arrsplit[1];
							args[x]=arrsplit[1];
						}
					}
				}
				if(args['NYRO_NO_CACHE']){
					//make sure the url is unique everytime
					myd=new Date()
					
					//make sure there is an '&' before adding this
					if(tar_url.charAt(tar_url.length-1)!='&'){
						tar_url+="&";
					}
					if( bkmark_inx == -1 ){
						bkmark_inx = surl.length;
					}
					tar_url = tar_url.substring(0,bkmark_inx) + "r="+myd.getTime() + tar_url.substring(bkmark_inx);
				}
				if(args['NYRO_HEIGHT']){
					settings.height = parseInt(args['NYRO_HEIGHT']);
					settings.minHeight = settings.height;
				}
				if(args['NYRO_WIDTH']){
					settings.width = parseInt(args['NYRO_WIDTH']);
					settings.minWidth = settings.width;
				}
				if(args['NYRO_MODAL']){
					settings.modal = true;
				}
				if(args['NYRO_TYPE']){
					settings.type = unescape(args['NYRO_TYPE']);
				}
				if(args['NYRO_TITLE']){
					settings.title = unescape(args['NYRO_TITLE']);
				}
				if(args['NYRO_BGCOLOR']){
					settings.bgColor = unescape(args['NYRO_BGCOLOR']);
				}
				

				if(surl){
					surl=tar_url;
				}
				jQuery.nyroModalSettings({
					url: surl
					,width: settings.width
					,minWidth: settings.minWidth
					,height: settings.height
					,minHeight: settings.minHeight
					,modal: settings.modal
					,type: settings.type
					,title: settings.title
					,bgColor: settings.bgColor
				});
			}
		};
	}else{
		alert("nyroModal url plugin:could not find: $.fn: " + $.fn );
	}
});
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 9/11/2008
 * @author Ariel Flesler
 * @version 1.4
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);
/**
 * $Id: printArea.js,v 1.1 2010/01/15 17:11:06 dbernabei Exp $
 *  Version 2.0
 *      -Contributors: "mindinquiring" : filter to exclude any stylesheet other than print.
 *  Tested ONLY in IE 8 and FF 3.5.3. No official support for other browsers, but will
 *      TRY to accomodate challenges in other browsers.
 *  Example:
 *      Print Button: <div id="print_button">Print</div>
 *      Print Area  : <div class="PrintArea"> ... html ... </div>
 *      Javascript  : <script>
 *                       $("div#print_button").click(function(){
 *                           $("div.PrintArea").printArea( [OPTIONS] );
 *                       });
 *                     </script>
 *  options are passed as json (json example: {mode: "popup", popClose: false})
 *
 *  {OPTIONS} | [type]    | (default), values    | Explanation
 *  --------- | --------- | -------------------- | -----------
 *  @mode     | [string]  | ("iframe"), "popup"  | printable window is either iframe or browser popup
 *  @popHt    | [number]  | (500)                | popup window height
 *  @popWd    | [number]  | (400)                | popup window width
 *  @popX     | [number]  | (500)                | popup window screen X position
 *  @popY     | [number]  | (500)                | popup window screen Y position
 *  @popTitle | [string]  | ('')                 | popup window title element
 *  @popClose | [boolean] | (false), true        | popup window close after printing
 */
(function($) {
    var counter = 0;
    var modes = { iframe : "iframe", popup : "popup" };
    var defaults = { mode     : modes.iframe,
                     popHt    : 500,
                     popWd    : 400,
                     popX     : 200,
                     popY     : 200,
                     popTitle : '',
                     popClose : false };

    var settings = {};//global settings

    $.fn.printArea = function( options )
        {
            $.extend( settings, defaults, options );

            counter++;
            var idPrefix = "printArea_";
            $( "[id^=" + idPrefix + "]" ).remove();
            var ele = $(this);

            settings.id = idPrefix + counter;

            var writeDoc;
            var printWindow;

            switch ( settings.mode )
            {
                case modes.iframe :
                    var f = new Iframe();
                    writeDoc = f.doc;
                    printWindow = f.contentWindow || f;
                    break;
                case modes.popup :
                    printWindow = new Popup();
                    writeDoc = printWindow.doc;
            }

            writeDoc.open();
            writeDoc.write("<html>" + getHead() + getBody(ele) + "</html>" );
            writeDoc.close();

            printWindow.focus();
            printWindow.print();

            if ( settings.mode == modes.popup && settings.popClose )
                printWindow.close();
        }

    function getHead()
    {
        var head = "<head><title>" + settings.popTitle + "</title>";
        $(document).find("link")
            .filter(function(){
                    return $(this).attr("rel").toLowerCase() == "stylesheet";
                })
            .filter(function(){ // this filter contributed by "mindinquiring"
                    var media = $(this).attr("media");
                    return (media.toLowerCase() == "" || media.toLowerCase() == "print")
                })
            .each(function(){
                    head += '<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" >';
                });
        head += "</head>";
        return head;
    }

    function getBody( printElement )
    {
        var body = "<body>";
        body += '<div class="' + $(printElement).attr("class") + '">' + $(printElement).html() + '</div>';
        body += "</body>";
        return body;
    }

    function Iframe()
    {
        var frameId = settings.id;

        var iframeStyle = 'border:0;position:absolute;width:0px;height:0px;left:0px;top:0px;';
        var iframe;

        try
        {
            iframe = document.createElement('iframe');
            document.body.appendChild(iframe);
            $(iframe).attr({ style: iframeStyle, id: frameId, src: "" });
            iframe.doc = null;
            iframe.doc = iframe.contentDocument ? iframe.contentDocument : ( iframe.contentWindow ? iframe.contentWindow.document : iframe.document);
        }
        catch( e ) { throw e + ". iframes may not be supported in this browser."; }

        if ( iframe.doc == null ) throw "Cannot find document.";

        return iframe;
    }

    function Popup()
    {
        var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no";
        windowAttr += ",width=" + settings.popWd + ",height=" + settings.popHt;
        windowAttr += ",resizable=yes,screenX=" + settings.popX + ",screenY=" + settings.popY + ",personalbar=no,scrollbars=no";

        var newWin = window.open( "", "_blank",  windowAttr );

        newWin.doc = newWin.document;

        return newWin;
    }
})(jQuery);
function GSI_Element(){this._settings={}};GSI_Element.prototype.start=function(placeHolder,settings){};GSI_Element.prototype._settings=null;GSI_Element.prototype._mergeSettings=function(obj){return GSI.functions.array_merge(this._settings,obj,true)}
var GSI_Element_Container=function(){function F(){};F.prototype=new GSI_Element();F.prototype._over=false;F.prototype.placeHolder;F.prototype.settings={onClick:function(){},css:{},content:false};F.prototype._draw=function(){};F.prototype.refresh=function(){var _mthis=this;_mthis._draw()};F.prototype._init=function(){var _mthis=this;_mthis.placeHolder.hover(function(){_mthis._over=true},function(){_mthis._over=false})};F.prototype.isOver=function(){var _mthis=this;return _mthis._over};F.prototype.start=function(placeHolder,settings){var _mthis=this;_mthis.placeHolder=$(placeHolder);_mthis.settings=GSI.functions.array_merge(_mthis.settings,settings);_mthis._init();_mthis._draw()};return new F()}
var GSI_Element_Container_Menu=function(){this.settings={timeoutLength:250,targetType:'target'};this._links=new Array()};GSI_Element_Container_Menu.prototype=new GSI_Element_Container();GSI_Element_Container_Menu.prototype._links=null;GSI_Element_Container_Menu.prototype.activeLink=null;GSI_Element_Container_Menu.prototype.show=function(callback){};GSI_Element_Container_Menu.prototype.hide=function(callback){};GSI_Element_Container_Menu.prototype.showElement=function(element,callback){element.showContent(callback)};GSI_Element_Container_Menu.prototype.hideElement=function(element,callback){element.hideContent(callback)};GSI_Element_Container_Menu.prototype.hideAll=function(){var _mthis=this;for(var aLink in _mthis._links){if(aLink=='indexOf')continue;_mthis._links[aLink].hideContent()};_mthis.resetAll();_mthis.activeLink=null};GSI_Element_Container_Menu.prototype.resetAll=function(){};GSI_Element_Container_Menu.prototype.addLink=function(element){var _mthis=this;_mthis._links.push(element)};GSI_Element_Container_Menu.prototype.activateLink=function(target){for(var aLink in this._links)if(this._links[aLink].target==target)return this._activateLink(this._links[aLink])};GSI_Element_Container_Menu.prototype._activateLink=function(link){var _mthis=this;_mthis.activeLink=link};GSI_Element_Container_Menu.prototype._createLink=function(){return new GSI_Element_Container_Link()};GSI_Element_Container_Menu.prototype.isOver=function(){var _mthis=this;for(var aLink in _mthis._links)if(_mthis._links[aLink].isOver())return true;return _mthis._over};GSI_Element_Container_Menu.prototype.start=function(placeHolder,settings){var _mthis=this;_mthis.placeHolder=$(placeHolder);_mthis.settings=GSI.functions.array_merge(_mthis.settings,settings);_mthis.placeHolder.css(_mthis.settings.css);_mthis._init();$('.GSI_link',_mthis.placeHolder).each(function(){var link=_mthis._createLink();link.start(this);_mthis.addLink(link);$(this).click(function(){_mthis._activateLink(link);_mthis.settings.onClick()})})}
var GSI_Element_Container_Menu_Tab=function(){function F(){};F.prototype=new GSI_Element_Container_Menu();F.prototype.settings={onClick:function(){},css:{},content:false,hideOnExit:true,targetType:'target'};F.prototype._activateLink=function(link){var _mthis=this;if(_mthis.activeLink===link)return;if(GSI.functions.isset(_mthis.activeLink)){_mthis.hideElement(_mthis.activeLink,function(){_mthis.activeLink=link;_mthis.showElement(link)})}else{_mthis.activeLink=link;_mthis.showElement(link)}};F.prototype.showElement=function(element,callback){var _mthis=this;element.showContent(callback)};F.prototype.start=function(placeHolder,settings){var _mthis=this;_mthis.placeHolder=$(placeHolder);_mthis.settings=GSI.functions.array_merge(_mthis.settings,settings);_mthis.placeHolder.css(_mthis.settings.css);_mthis._init();$('.GSI_link',_mthis.placeHolder).each(function(){var link=_mthis._createLink();link.start(this,_mthis.settings);_mthis.addLink(link);link.click=function(){};if(_mthis.settings['activateEvent']=='hover'){$(this).hover(function(){_mthis._activateLink(link);_mthis.settings.onClick()},function(){_mthis.hideAll()})}else $(this).click(function(e){e.preventDefault();_mthis._activateLink(link);_mthis.settings.onClick();return false});var target=$(this).is('a')?this[_mthis.settings.targetType]:$('a',this).attr(_mthis.settings.targetType),activeTab=_mthis.settings.activeTab?_mthis.settings.activeTab:'';if(target==window.location.hash.replace('#','')){_mthis._activateLink(link);return};if(target==activeTab){_mthis._activateLink(link);return}});if(_mthis.settings.hideOnExit)$(document).mousedown(function(){if(_mthis.isOver())return;_mthis.hideAll()});_mthis.placeHolder.fadeIn('slow')};return new F()}
var GSI_Element_Container_Link=function(){this.placeHolder;this._element=false;this.target='';this.settings={onClick:function(){},css:{},targetType:'target',content:false}};GSI_Element_Container_Link.prototype=new GSI_Element_Container();GSI_Element_Container_Link.prototype.getElement=function(){return this._element};GSI_Element_Container_Link.prototype.show=function(callback){if(!GSI.functions.isset(callback))callback=function(){};this.placeHolder.show();callback()};GSI_Element_Container_Link.prototype.hide=function(callback){if(!GSI.functions.isset(callback))callback=function(){};this.placeHolder.hide();callback()};GSI_Element_Container_Link.prototype.showContent=function(callback){if(this._element)this._element.show(callback);this.placeHolder.addClass('active')};GSI_Element_Container_Link.prototype.hideContent=function(callback){if(this._element)this._element.hide(callback);this.placeHolder.removeClass('active')};GSI_Element_Container_Link.prototype.toggleContent=function(callback){if(this.placeHolder.hasClass('active')){this.hideContent(callback)}else this.showContent(callback)};GSI_Element_Container_Link.prototype.click=function(){this.showContent()};GSI_Element_Container_Link.prototype._draw=function(){if(this.settings.content)this.placeHolder.html(this.settings.content)};GSI_Element_Container_Link.prototype.refresh=function(){this._draw()};GSI_Element_Container_Link.prototype._createElement=function(){return new GSI_Element_Container_Content()};GSI_Element_Container_Link.prototype.setElement=function(element){this._element=element};GSI_Element_Container_Link.prototype.isOver=function(){if(this._element.isOver())return true;return this._over};GSI_Element_Container_Link.prototype.start=function(placeHolder,settings){var _mthis=this;this.placeHolder=$(placeHolder);this.settings=GSI.functions.array_merge(this.settings,settings);this.placeHolder.css(this.settings.css);this._init();if($(this.placeHolder).is('a')){var elements=this.placeHolder}else var elements=$('a',this.placeHolder);elements.each(function(){var content=_mthis._createElement();_mthis.target=this[_mthis.settings.targetType];content.start('#'+_mthis.target,_mthis.settings);_mthis.setElement(content)});this._draw()}
var GSI_Element_Container_Content=function(){function F(){};F.prototype=new GSI_Element_Container();F.prototype.placeHolder;F.prototype.settings={onClick:function(){},css:{},content:false};F.prototype.show=function(callback){var _mthis=this;if(!GSI.functions.isset(callback))callback=function(){};_mthis.placeHolder.show();callback()};F.prototype.toggle=function(callback){var _mthis=this;if(!GSI.functions.isset(callback))callback=function(){};_mthis.placeHolder.toggle();callback()};F.prototype.hide=function(callback){var _mthis=this;if(!GSI.functions.isset(callback))callback=function(){};_mthis.placeHolder.hide();callback()};F.prototype._draw=function(){var _mthis=this;if(_mthis.settings.content)_mthis.placeHolder.html(_mthis.settings.content)};F.prototype.refresh=function(){var _mthis=this;_mthis._draw()};F.prototype.start=function(placeHolder,settings){var _mthis=this;_mthis.placeHolder=$(placeHolder);_mthis.settings=GSI.functions.array_merge(_mthis.settings,settings);_mthis.placeHolder.css(_mthis.settings.css);_mthis._init();_mthis._draw()};return new F()}
var GSI_ICC_PEAK_Element_Container_Menu_Tab_TopMenu=function(){function F(){};F.prototype=new GSI_Element_Container_Menu_Tab();F.prototype._activateLink=function(link){var _mthis=this,doShow=function(){_mthis.activeLink=link;_mthis.showElement(link);for(var aLink in _mthis._links){if(_mthis._links[aLink]=='indexOf')continue;if(_mthis._links[aLink]==_mthis.activeLink){_mthis._links[aLink].placeHolder.removeClass('disabled')}else _mthis._links[aLink].placeHolder.addClass('disabled')}};if(_mthis.activeLink===link){_mthis.hideElement(_mthis.activeLink,function(){_mthis.activeLink=null;for(var aLink in _mthis._links){if(_mthis._links[aLink]=='indexOf')continue;_mthis._links[aLink].placeHolder.removeClass('disabled')}});return};if(GSI.functions.isset(_mthis.activeLink)){_mthis.hideElement(_mthis.activeLink,doShow);return};doShow()};F.prototype.resetAll=function(){var _mthis=this;for(var aLink in _mthis._links){if(_mthis._links[aLink]=='indexOf')continue;_mthis._links[aLink].placeHolder.removeClass('disabled')}};F.prototype._createLink=function(){return new GSI_ICC_PEAK_Element_Container_Link_TopMenu()};return new F()}
var GSI_ICC_PEAK_Element_Container_Link_TopMenu=function(){function F(){};F.prototype=new GSI_Element_Container_Link();F.prototype._createElement=function(){return new GSI_ICC_PEAK_Element_Container_Content_TopMenu()};return new F()}
var GSI_ICC_PEAK_Element_Container_Content_TopMenu=function(){function F(){};F.prototype=new GSI_Element_Container_Content();F.prototype.show=function(callback){var _mthis=this;if(!GSI.functions.isset(callback))callback=function(){};_mthis.placeHolder.slideDown(500,callback)};F.prototype.hide=function(callback){var _mthis=this;if(!GSI.functions.isset(callback))callback=function(){};_mthis.placeHolder.slideUp(500,callback)};return new F()}
