// -------------------------------------------
// Copyright (c) BSRIA Ltd.
// -------------------------------------------

var input_id = 0;
var _submit = false;

// -------------------------------------------
// When the page has loaded, run these scripts
// -------------------------------------------
$(document).ready(function () {
 $("a[rel]").colorbox({maxWidth: "80%", maxHeight: "80%", opacity: "0.5"});
 highlight_table('table_member','table_memberh');
 check_country_form();
});

// -------------------------------------------
// BSRIA
// -------------------------------------------
function bsria_helps_people() {
 $('#bsriahelpspeople-moretxt').hide();
 $('#bsriahelpspeople-more').slideDown("fast");
}

function search_click(lookup){
 lookup.focus();
 lookup.select();
}

// -------------------------------------------
// Document/e-News reg
// -------------------------------------------
function check_country_form(){
 if($('#country').val()=='United Kingdom')
  $("#county").removeAttr("disabled"); 
 else {
  $("#county option:eq(0)").attr("selected", "selected");
  $("#county").attr("disabled","disabled");
 }
}

// -------------------------------------------
// Member listing
// -------------------------------------------
function highlight_table(what,highlight_class) {
 $('#' + what + ' tr').hover(
  function() {
   $(this).addClass(highlight_class);
  },
  function() {
   $(this).removeClass(highlight_class);
  }
 );
}

function member_list(mid) {
 document.getElementById('mid').value = mid;
 document.memberfrm.submit();
}

// -------------------------------------------
// Infonet / Bookshop
// -------------------------------------------
function search_select_change(what) {
 switch(what.value) {
  case 'bt':
  case 'bm':
  case 't':
  case 'm':
   search_select_change_remove('library');
   search_select_change_remove('bsria');
   break;
  case 'l':
   search_select_change_remove('bookshop');
   search_select_change_remove('bsria');
   break;
  case 'b':
   search_select_change_remove('bookshop');
   search_select_change_remove('library');
   break;
  case 'bs':
   search_select_change_remove('bookshop');
   break;
 }
}

function search_select_change_remove(what) {
 switch(what) {
  case 'bookshop':
   $('input[name="section"][value="t"]').removeAttr("checked");
   $('input[name="section"][value="m"]').removeAttr("checked");
   $('input[name="section"][value="bt"]').removeAttr("checked");
   $('input[name="section"][value="bm"]').removeAttr("checked");
   break;
  case 'bsria':
   $('input[name="section"][value="b"]').removeAttr("checked");
   $('input[name="section"][value="bs"]').removeAttr("checked");
   break;
  case 'library':
   $('input[name="section"][value="l"]').removeAttr("checked");
   break;
  }
}

function search_select_submit(s) {
var url,target='';

 if($('input[name="section"][value="bt"]').attr("checked") || $('input[name="section"][value="bm"]').attr("checked"))
  url = '/bookshop/search/';
 if($('input[name="section"][value="l"]').attr("checked"))
  url = '/search/library/';
 if($('input[name="section"][value="b"]').attr("checked")) {
  url = 'https://www.bsria.co.uk/search/';
  target = '_blank';
  s = '';
 }
 if($('input[name="section"][value="bs"]').attr("checked")) {
  url = '/search/';
  s = '';
 }

 if(!url)url=$('#search').attr('action');

 $('#search').attr('action',s+url);  
 $('#search').attr('target',target);  

 return true;
}

function basket_qty(what,direction) {
var obj_hard = document.getElementById('basket_qty_hard');
var obj_bulk = document.getElementById('basket_qty_bulk');
var obj_site = document.getElementById('basket_qty_site');
var obj_multisite = document.getElementById('basket_qty_multisite');
var obj_electronic = document.getElementById('basket_qty_electronic');
var obj_cd = document.getElementById('basket_qty_cd');

 switch(direction) {
  case 'up':
   switch(what) {
    case 'hard':
     if(obj_site)
      obj_site.value=0;
     if(obj_multisite)
      obj_multisite.value=0;
     if(obj_electronic)
      obj_electronic.value=0;
     obj_hard.value++;
     return false;
     break;
    case 'cd':
     obj_cd.value++;
     return false;
     break;
    case 'bulk': 
     if(obj_site)
      obj_site.value=0;
     if(obj_multisite)
      obj_multisite.value=0;
     if(obj_electronic)
      obj_electronic.value=0;
     obj_bulk.value++;
     return false;
     break;
    case 'site':
     if(obj_hard)
      obj_hard.value=0;
     if(obj_bulk)
      obj_bulk.value=0;
     if(obj_multisite)
      obj_multisite.value=0;
     if(obj_electronic)
      obj_electronic.value=0;
     obj_site.value=1;
     return false;
     break;
    case 'multisite':
     if(obj_hard)
      obj_hard.value=0;
     if(obj_bulk)
      obj_bulk.value=0;
     if(obj_site)
      obj_site.value=0;
     if(obj_electronic)
      obj_electronic.value=0;
     obj_multisite.value=1;
     return false;
     break;
    case 'electronic':
     if(obj_hard)
      obj_hard.value=0;
     if(obj_cd)
      obj_cd.value=0;
     if(obj_bulk)
      obj_bulk.value=0;
     if(obj_site)
      obj_site.value=0;
     if(obj_multisite)
      obj_multisite.value=0;
     obj_electronic.value=1;
     return false;
     break;
   }

  case 'down':
   switch(what) {
    case 'hard':
     if(obj_site)
      obj_site.value=0;
     if(obj_multisite)
      obj_multisite.value=0;
     if(obj_electronic)
      obj_electronic.value=0;
     if(obj_hard.value>0)
      obj_hard.value--;
     return false;
     break;
    case 'cd':
     if(obj_cd.value>0)
      obj_cd.value--;
     return false;
     break;
    case 'bulk': 
     if(obj_site)
      obj_site.value=0;
     if(obj_multisite)
      obj_multisite.value=0;
     if(obj_electronic)
      obj_electronic.value=0;
     if(obj_bulk.value>0)
      obj_bulk.value--;
     return false;
     break;
    case 'site':
     if(obj_hard)
      obj_hard.value=0;
     if(obj_bulk)
      obj_bulk.value=0;
     if(obj_multisite)
      obj_multisite.value=0;
     if(obj_electronic)
      obj_electronic.value=0;
     if(obj_site.value>0)
      obj_site.value=0;
     return false;
     break;
    case 'multisite':
     if(obj_hard)
      obj_hard.value=0;
     if(obj_bulk)
      obj_bulk.value=0;
     if(obj_site)
      obj_site.value=0;
     if(obj_multisite.value>0)
      obj_multisite.value=0;
     return false;
     break;
    case 'electronic':
     if(obj_hard)
      obj_hard.value=0;
     if(obj_cd)
      obj_cd.value=0;
     if(obj_bulk)
      obj_bulk.value=0;
     if(obj_site)
      obj_site.value=0;
     if(obj_multisite)
      obj_multisite.value=0;
     obj_electronic.value=0;
     return false;
     break;
   }
  }
 return false;
}

function basket_check(what) {
var obj_hard = document.getElementById('basket_qty_hard');
var obj_electronic = document.getElementById('basket_qty_electronic');
var obj_site = document.getElementById('basket_qty_site');
var obj_multisite = document.getElementById('basket_qty_multisite');
var obj_bulk = document.getElementById('basket_qty_bulk');


 switch(what) {
  case 'hard':
   if(obj_site)
    obj_site.value=0;
   if(obj_multisite)
    obj_multisite.value=0;
   if(obj_electronic)
    obj_electronic.value=0;
   return false;
   break;
  case 'bulk': 
   if(obj_site)
    obj_site.value=0;
   if(obj_multisite)
    obj_multisite.value=0;
   if(obj_electronic)
    obj_electronic.value=0;
   return false;
   break;
  case 'site':
   if(obj_hard)
    obj_hard.value=0;
   if(obj_bulk)
    obj_bulk.value=0;
   if(obj_multisite)
    obj_multisite.value=0;
   if(obj_electronic)
    obj_electronic.value=0;
   if(obj_site.value>1)
    obj_site.value=1;
   return false;
   break;
  case 'multisite':
   if(obj_hard)
    obj_hard.value=0;
   if(obj_bulk)
    obj_bulk.value=0;
   if(obj_site)
    obj_site.value=0;
   if(obj_electronic)
    obj_electronic.value=0;
   if(obj_multisite.value>1)
    obj_multisite.value=1;
   return false;
   break;
  case 'electronic':
   if(obj_hard)
    obj_hard.value=0;
   if(obj_bulk)
    obj_bulk.value=0;
   if(obj_site)
    obj_site.value=0;
   if(obj_multisite)
    obj_multisite.value=0;
   if(obj_electronic.value>1)
    obj_electronic.value=1;
   return false;
   break;
 }
}



function basket_action(action) { 
 $('#basket_a').attr('value',action);  
 return true;
}

function basket_check_country() {
 if($("#basket_country").length==0)
  return true;
 else {
  if(!isNumeric($("#basket_country").val())) {
   infonet_message('basket_country');
   return false;
  }
  else
   return true;
 }
}

function checkout_copy_invoice() { 
 $('#delivery_street1').attr('value',$('#invoice_street1').attr('value'));  
 $('#delivery_street2').attr('value',$('#invoice_street2').attr('value'));  
 $('#delivery_town').attr('value',$('#invoice_town').attr('value'));  
 $('#delivery_county').attr('value',$('#invoice_county').attr('value'));  
 $('#delivery_postcode').attr('value',$('#invoice_postcode').attr('value'));  
}

function checkout_payment_show(id) {
 $('#payment_fax').hide();
 $('#payment_phone').hide();
 $('#payment_po').hide();
 $('#'+id).show();
}

function infonet_login(b) {
 $.fn.colorbox({href: "/ajax/login/?v=" + b,opacity: "0.5",open: true})
}

function infonet_login_reminder() {
 $.fn.colorbox({href: "/ajax/login-reminder/",opacity: "0.5",open: true})
}

function infonet_payment_pending() {
 $.fn.colorbox({href: "/ajax/payment-pending/",opacity: "0.5",open: true});return false
}

function infonet_payment_electronic() {
 $.fn.colorbox({href: "/ajax/payment-electronic/",opacity: "0.5",open: true});return false
}

function infonet_payment_restriction() {
 $.fn.colorbox({href: "/ajax/payment-restriction/",opacity: "0.5",open: true});return false
}

function infonet_message(msg) {
 $.fn.colorbox({href: "/ajax/message/?msg="+msg,opacity: "0.5",open: true});return false
}


function listing_toggle() {
 if ($('#ad_status').is(':checked'))
  $('#ad').removeAttr('disabled');
 else
  $('#ad').attr('disabled', true);
}

// -------------------------------------------
// General
// -------------------------------------------
function redirect(url) {
 document.location.href= url;
}

function back() {
 history.go(-1);
}

function isNumeric(what) { 
 if (what.match(/^\d+$/) == null) 
  return false; 
 else 
 return true; 
} 

function addElement(parentId, elementTag, elementId, html) {
 var p = document.getElementById(parentId);
 var newElement = document.createElement(elementTag);
 newElement.setAttribute('id', elementId);
 newElement.innerHTML = html;
 p.appendChild(newElement);
}

function removeElement(elementId) {
 input_id = document.getElementById('additional').value;
 var element = document.getElementById(elementId);
 element.parentNode.removeChild(element);
}

function add_input(what,default_value) {
 input_id = document.getElementById('additional').value;
 input_id++;
 var html = '<input type="input" name="additional' + input_id + '" value="' + default_value +'" /> <a href="" onclick="javascript:removeElement(\'additional-' + input_id + '\'); return false;">Remove ' + what + '</a>';
 addElement('files', 'p', 'additional-' + input_id, html);
 document.getElementById('additional').value = input_id;
}

function check_max_length(what) {
 var mlength=what.getAttribute? parseInt(what.getAttribute("maxlength")) : "";
 if (what.getAttribute && what.value.length>mlength)
 what.value=what.value.substring(0,mlength);
}

function input_highlight(lookup){
 lookup.focus();
 lookup.select();
}

function toggle_div(what){
 $("#"+what).toggle();
}

function do_xmlhttp(u){
 initxmlhttp();
 if(req!=null){
  req.onreadystatechange = processxmlhttp;
  req.open("GET",u,true);
  req.send(null);
 }
}

function initxmlhttp(){
 try{req=new ActiveXObject("Msxml2.XMLHTTP");}
 catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}
 catch(oc){req=null;}}
 if(!req&&typeof XMLHttpRequest!="undefined")
  req=new XMLHttpRequest();
}

function processxmlhttp(){
 if(req.readyState==4){
  if(req.status==200){
   if(req.responseText=="")
    alert('error1');
   else{
    if(req.responseText=='eof')
     alert('no results');
    else{
     eval(req.responseText);
    }
   }
  }
  else{
   alert('A technical error occurred. resulted output was:'+req.responseText);
  }
 }
}



function add_delegate() {
 var delegates = $('#additional').attr('value');
 delegates++;
 $('#additional').attr('value',delegates);  
 $("#delegates").append('<p style="display: hidden;" id="additional-' + delegates +'"><input type="input" id="delegates' + delegates + '" name="additional' + delegates + '" size="40" maxlength="50" value="" /> <a href="#" onclick="javascript:remove_delegate(\'#additional-' + delegates + '\');return false;">Remove delegate</a></p>');
}

function remove_delegate(what) {
 $(what).hide("fast", function(){$(what).remove()});
}

function event_terms(event) {
 $.fn.colorbox({href: "/ajax/event-terms/?event="+event,opacity: "0.5",open: true});return false
}


// -------------------------------------------
// Other scripts
// -------------------------------------------
(function(a){a.fn.extend({reflect:function(b){b=a.extend({height:0.20,opacity:0.5},b);return this.unreflect().each(function(){var c=this;if(/^img$/i.test(c.tagName)){function d(){var j,g=Math.floor(c.height*b.height),k,f,i;if(a.browser.msie){j=a("<img />").attr("src",c.src).css({width:c.width,height:c.height,marginBottom:-c.height+g,filter:"flipv progid:DXImageTransform.Microsoft.Alpha(opacity="+(b.opacity*100)+", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="+(b.height*100)+")"})[0]}else{j=a("<canvas />")[0];if(!j.getContext){return}f=j.getContext("2d");try{a(j).attr({width:c.width,height:g});f.save();f.translate(0,c.height-1);f.scale(1,-1);f.drawImage(c,0,0,c.width,c.height);f.restore();f.globalCompositeOperation="destination-out";i=f.createLinearGradient(0,0,0,g);i.addColorStop(0,"rgba(255, 255, 255, "+(1-b.opacity)+")");i.addColorStop(1,"rgba(255, 255, 255, 1.0)");f.fillStyle=i;f.rect(0,0,c.width,g);f.fill()}catch(h){return}}a(j).css({display:"block",border:0});k=a(/^a$/i.test(c.parentNode.tagName)?"<span />":"<div />").insertAfter(c).append([c,j])[0];k.className=c.className;a.data(c,"reflected",k.style.cssText=c.style.cssText);a(k).css({width:c.width,height:c.height+g,overflow:"hidden"});c.style.cssText="display: block; border: 0px";c.className="reflected"}if(c.complete){d()}else{a(c).load(d)}}})},unreflect:function(){return this.unbind("load").each(function(){var c=this,b=a.data(this,"reflected"),d;if(b!==undefined){d=c.parentNode;c.className=d.className;c.style.cssText=b;a.removeData(c,"reflected");d.parentNode.replaceChild(c,d)}})}})})(jQuery);jQuery(function($){$("img.reflect").reflect({})});
(function(C){var I,X,Y,d,A,k,b,H,c,T,F,f,s,j,m,R,l,J,t,E,Z,i,g,a,w,S,p,B,V,x,K,q="colorbox",o="hover",z,e,U,N,M,L,r,O,y="cbox_open",Q="cbox_load",u="cbox_complete",h="cbox_close",n="cbox_closed",D={transition:"elastic",speed:350,width:false,height:false,initialWidth:"200",initialHeight:"200",maxWidth:false,maxHeight:false,resize:true,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:true,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:true,slideshow:false,slideshowAuto:true,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow"};function P(aa){if(aa.keyCode===37){aa.preventDefault();J.click()}else{if(aa.keyCode===39){aa.preventDefault();l.click()}}}function G(aa,ab){ab=ab==="x"?document.documentElement.clientWidth:document.documentElement.clientHeight;return(typeof aa==="string")?(aa.match(/%/)?(ab/100)*parseInt(aa,10):parseInt(aa,10)):aa}function v(aa){return V.photo?true:aa.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function W(){for(var aa in V){if(typeof(V[aa])==="function"){V[aa]=V[aa].call(p)}}}C.fn.colorbox=function(ab,aa){if(this.length){this.each(function(){var ac=C(this).data(q)?C.extend({},C(this).data(q),ab):C.extend({},D,ab);C(this).data(q,ac).addClass("cboxelement")})}else{C(this).data(q,C.extend({},D,ab))}C(this).unbind("click.colorbox").bind("click.colorbox",function(ad){p=this;V=C(p).data(q);W();C().bind("keydown.cbox_close",function(ae){if(ae.keyCode===27){ae.preventDefault();t.click()}});if(V.overlayClose===true){I.css({cursor:"pointer"}).one("click",O)}p.blur();K=aa||false;var ac=V.rel||p.rel;if(ac&&ac!=="nofollow"){c=C(".cboxelement").filter(function(){var ae=C(this).data(q).rel||this.rel;return(ae===ac)});B=c.index(p);if(B<0){c=c.add(p);B=c.length-1}}else{c=C(p);B=0}if(!x){C.event.trigger(y);t.html(V.close);I.css({opacity:V.opacity}).show();x=true;M(G(V.initialWidth,"x"),G(V.initialHeight,"y"),0);if(C.browser.msie&&C.browser.version<7){T.bind("resize.cboxie6 scroll.cboxie6",function(){I.css({width:T.width(),height:T.height(),top:T.scrollTop(),left:T.scrollLeft()})}).trigger("scroll.cboxie6")}}r();N();ad.preventDefault()});if(ab&&ab.open){C(this).triggerHandler("click.colorbox")}return this};U=function(){function aa(ab){return C('<div id="cbox'+ab+'"/>')}T=C(window);X=C('<div id="colorbox"/>');I=aa("Overlay").hide();Y=aa("Wrapper");d=aa("Content").append(F=aa("LoadedContent").css({width:0,height:0}),f=aa("LoadingOverlay"),s=aa("LoadingGraphic"),j=aa("Title"),m=aa("Current"),R=aa("Slideshow"),l=aa("Next"),J=aa("Previous"),t=aa("Close"));Y.append(C("<div/>").append(aa("TopLeft"),A=aa("TopCenter"),aa("TopRight")),C("<div/>").append(k=aa("MiddleLeft"),d,b=aa("MiddleRight")),C("<div/>").append(aa("BottomLeft"),H=aa("BottomCenter"),aa("BottomRight"))).children().children().css({"float":"left"});C("body").prepend(I,X.append(Y));if(C.browser.msie&&C.browser.version<7){I.css("position","absolute")}d.children().addClass(o).mouseover(function(){C(this).addClass(o)}).mouseout(function(){C(this).removeClass(o)}).hide();Z=A.height()+H.height()+d.outerHeight(true)-d.height();i=k.width()+b.width()+d.outerWidth(true)-d.width();g=F.outerHeight(true);a=F.outerWidth(true);X.css({"padding-bottom":Z,"padding-right":i}).hide();l.click(e);J.click(z);t.click(O);d.children().removeClass(o)};M=function(ad,ac,ab,ae){var af=document.documentElement.clientHeight,ah=af/2-ac/2,ag=document.documentElement.clientWidth/2-ad/2,aa;if(ac>af){ah-=(ac-af)}if(ah<0){ah=0}if(ag<0){ag=0}ah+=T.scrollTop();ag+=T.scrollLeft();ad=ad-i;ac=ac-Z;aa=(X.width()===ad&&X.height()===ac)?0:ab;Y[0].style.width=Y[0].style.height="9999px";function ai(aj){A[0].style.width=H[0].style.width=d[0].style.width=aj.style.width;s[0].style.height=f[0].style.height=d[0].style.height=k[0].style.height=b[0].style.height=aj.style.height}X.dequeue().animate({height:ac,width:ad,top:ah,left:ag},{duration:aa,complete:function(){ai(this);Y[0].style.width=(ad+i)+"px";Y[0].style.height=(ac+Z)+"px";if(ae){ae()}},step:function(){ai(this)}})};L=function(af){if(!x){return}T.unbind("resize.cbox_resize");var ab,al,ag,ae,ac,ai,am,aa,ad=V.transition==="none"?0:V.speed;F.remove();F=C(af);function aj(){if(V.width){ab=w}else{ab=w&&w<F.width()?w:F.width()}return ab}function ah(){if(V.height){al=S}else{al=S&&S<F.height()?S:F.height()}return al}F.hide().appendTo("body").attr({id:"cboxLoadedContent"}).css({width:aj()}).css({height:ah()}).prependTo(d);if(C.browser.msie&&C.browser.version<7){C("select:not(#colorbox select)").filter(function(){return C(this).css("visibility")!=="hidden"}).css({visibility:"hidden"}).one(h,function(){C(this).css({visibility:"inherit"})})}aa=C("#cboxPhoto")[0];if(aa&&V.height){ag=(al-parseInt(aa.style.height,10))/2;aa.style.marginTop=(ag>0?ag:0)+"px"}function ak(ao){var an=ab+a+i,ap=al+g+Z;M(an,ap,ao,function(){if(!x){return}if(C.browser.msie){if(aa){F.fadeIn(100)}X.css("filter","")}d.children().show();C("#cboxIframeTemp").after("<iframe id='cboxIframe' name='iframe_"+new Date().getTime()+"' frameborder=0 src='"+(V.href||p.href)+"' />").remove();f.hide();s.hide();R.hide();if(c.length>1){m.html(V.current.replace(/\{current\}/,B+1).replace(/\{total\}/,c.length));l.html(V.next);J.html(V.previous);C().unbind("keydown",P).bind("keydown",P);if(V.slideshow){R.show()}}else{m.hide();l.hide();J.hide()}j.html(V.title||p.title);C.event.trigger(u);if(K){K.call(p)}if(V.transition==="fade"){X.fadeTo(ad,1,function(){if(C.browser.msie){d.css("filter","")}})}T.bind("resize.cbox_resize",function(){M(an,ap,0)})})}if(V.transition==="fade"){X.fadeTo(ad,0,function(){ak(0)})}else{ak(ad)}if(V.preloading&&c.length>1){ae=B>0?c[B-1]:c[c.length-1];ai=B<c.length-1?c[B+1]:c[0];am=C(ai).data(q).href||ai.href;ac=C(ae).data(q).href||ae.href;if(v(am)){C("<img />").attr("src",am)}if(v(ac)){C("<img />").attr("src",ac)}}};N=function(){var aa,ad,ab,ac;p=c[B];V=C(p).data(q);W();C.event.trigger(Q);aa=V.height?G(V.height,"y")-g-Z:false;ad=V.width?G(V.width,"x")-a-i:false;ab=V.href||p.href;f.show();s.show();t.show();if(V.maxHeight){S=V.maxHeight?G(V.maxHeight,"y")-g-Z:false;aa=aa&&aa<S?aa:S}if(V.maxWidth){w=V.maxWidth?G(V.maxWidth,"x")-a-i:false;ad=ad&&ad<w?ad:w}S=aa;w=ad;if(V.inline){C('<div id="cboxInlineTemp" />').hide().insertBefore(C(ab)[0]).bind(Q+" "+h,function(){F.children().insertBefore(this);C(this).remove()});L(C(ab).wrapAll("<div/>").parent())}else{if(V.iframe){L(C("<div><div id='cboxIframeTemp' /></div>"))}else{if(V.html){L(C("<div/>").html(V.html))}else{if(v(ab)){ac=new Image();ac.onload=function(){ac.onload=null;if((S||w)&&V.resize){var ag=this.width,ae=this.height,ai=0,ah=this,af=function(){ae+=ae*ai;ag+=ag*ai;ah.height=ae;ah.width=ag};if(w&&ag>w){ai=(w-ag)/ag;af()}if(S&&ae>S){ai=(S-ae)/ae;af()}}L(C("<div />").css({width:this.width,height:this.height}).append(C(this).css({width:this.width,height:this.height,display:"block",margin:"auto",border:0}).attr("id","cboxPhoto")));if(c.length>1){C(this).css({cursor:"pointer"}).click(e)}if(C.browser.msie&&C.browser.version==7){this.style.msInterpolationMode="bicubic"}};ac.src=ab}else{C("<div />").load(ab,function(ae,af){if(af==="success"){L(C(this))}else{L(C("<p>Request unsuccessful.</p>"))}})}}}}};e=function(){B=B<c.length-1?B+1:0;N()};z=function(){B=B>0?B-1:c.length-1;N()};r=function(){var ab,aa,ac="cboxSlideshow_";R.bind(h,function(){clearTimeout(aa);R.unbind()});function ad(){R.text(V.slideshowStop).bind(u,function(){aa=setTimeout(e,V.slideshowSpeed)}).bind(Q,function(){clearTimeout(aa)}).one("click",function(){ab();C(this).removeClass(o)});X.removeClass(ac+"off").addClass(ac+"on")}ab=function(){clearTimeout(aa);R.text(V.slideshowStart).unbind(u+" "+Q).one("click",function(){ad();aa=setTimeout(e,V.slideshowSpeed);C(this).removeClass(o)});X.removeClass(ac+"on").addClass(ac+"off")};if(V.slideshow&&c.length>1){if(V.slideshowAuto){ad()}else{ab()}}};O=function(){C.event.trigger(h);x=false;C().unbind("keydown",P).unbind("keydown.cbox_close");T.unbind("resize.cbox_resize resize.cboxie6 scroll.cboxie6");I.css({cursor:"auto"}).fadeOut("fast");d.children().hide();X.stop(true,false).removeClass().fadeOut("fast",function(){F.remove();X.css({opacity:1});C.event.trigger(n)})};E=C.fn.colorbox;E.init=U;E.next=e;E.prev=z;E.close=O;E.load=N;E.position=M;E.dimensions=L;E.element=function(){return p};E.settings=D;C(function(){U()})}(jQuery));
