// (C) 2006-2011 Timothy Akehurst - Powered by AgenceWare
Core={version:"0.7"};Core.apply=function(e,f,b){if(b){Core.apply(e,b)}if(e&&f&&typeof f=="object"){for(var a in f){e[a]=f[a]}}return e};(function(){var r=Object.prototype.toString,s=navigator.userAgent.toLowerCase(),x=function(e){return e.test(s)},h=document,k=h.compatMode=="CSS1Compat",z=x(/opera/),g=x(/chrome/),t=x(/webkit/),w=!g&&x(/safari/),f=w&&x(/applewebkit\/4/),b=w&&x(/version\/3/),A=w&&x(/version\/4/),q=!z&&x(/msie/),o=q&&x(/msie 7/),n=q&&x(/msie 8/),p=q&&!o&&!n,m=!t&&x(/gecko/),d=m&&x(/rv:1\.8/),a=m&&x(/rv:1\.9/),u=q&&!k,y=x(/windows|win32/),j=x(/macintosh|mac os x/),i=x(/adobeair/),l=x(/linux/),c=/^https/i.test(window.location.protocol);if(p){try{h.execCommand("BackgroundImageCache",false,true)}catch(v){}}Core.apply(Core,{emptyFunction:function(){},extend:function(C,e){for(var B in e){C[B]=e[B];return C}},isArray:function(e){return r.apply(e)==="[object Array]"},isEmpty:function(B,e){return B===null||B===undefined||((Core.isArray(B)&&!B.length))||(!e?B==="":false)},isFunction:function(e){return r.apply(e)==="[object Function]"},isBoolean:function(e){return typeof e==="boolean"},isString:function(e){return typeof e==="string"},isObject:function(e){return !!e&&Object.prototype.toString.call(e)==="[object Object]"},isIterable:function(e){if(Core.isArray(e)||e.callee){return true}if(/NodeList|HTMLCollection/.test(r.call(e))){return true}return((typeof e.nextNode!="undefined"||e.item)&&Core.isNumber(e.length))},isPrimitive:function(e){return Core.isString(e)||Core.isNumber(e)||Core.isBoolean(e)},isNumber:function(e){return typeof e==="number"&&isFinite(e)},each:function(E,D,C){if(Core.isEmpty(E,true)){return}if(!Core.isIterable(E)||Core.isPrimitive(E)){E=[E]}for(var B=0,e=E.length;B<e;B++){if(D.call(C||E[B],E[B],B,E)===false){return B}}},isOpera:z,isWebKit:t,isChrome:g,isSafari:w,isSafari3:b,isSafari4:A,isSafari2:f,isIE:q,isIE6:p,isIE7:o,isIE8:n,isGecko:m,isGecko2:d,isGecko3:a,isBorderBox:u,isLinux:l,isWindows:y,isMac:j,isAir:i})})();var IdoleSite={Card:{offset:330,isFav:false,init:function(b){$(window).resize(function(i){var g=$(this).height()-240;var f=$(this).width()-270;$("#content").height(g);$(".previewContainer").height(g);$(".scroll-pane").jScrollPane({showArrows:true})}).resize();IdoleSite.Card.setupThumbs(b);var e=Cookie.read("resFavCookie");e=(e!=null)?decodeURIComponent(e).split(","):[];var d=""+b.id+":"+b.name+"";var a=$.inArray(d,e);if(a>-1){IdoleSite.Card.toggleFav(1)}$(".favBtn").click(function(){var f=IdoleSite.Card.isFav;if(f){e.splice(a,1);Cookie.create("resFavCookie",encodeURIComponent(e.join(",")),{path:"/",expires:8760});IdoleSite.Card.toggleFav(0)}else{e.push(d);Cookie.create("resFavCookie",encodeURIComponent(e.join(",")),{path:"/",expires:8760});IdoleSite.Card.toggleFav(1)}});var c=$("<div/>",{id:"print-window"}).load("printoptions.html",function(g){var h=$(this);var f=0;h.find("#resourceTitle").html(b.name);h.find(".btnDownload").click(function(k){h.find("input:checked").each(function(l,m){f=$(m).val()});var i="";var j=$("#picPerPage").val();if(j){i+="&np="+j}if(b.isPortfolio){i+="&pid="+b.pid}window.location="print.php?id="+b.id+"&p="+f+i;IdoleSite.Card.togglePrint()})});$("body").append(c);$("#screen-overlay").click(function(f){$(this).hide();c.hide()})},togglePrint:function(){$("#screen-overlay").hide();$("#print-window").hide("")},toggleFav:function(b){var a=["Add to Favorites","Remove from Favorites"];$(".favBtn").text(a[b]);if(b==1){IdoleSite.Card.isFav=true;IdoleSite.setupFav(true)}else{if(b==0){IdoleSite.Card.isFav=false;IdoleSite.setupFav(true)}}},setupThumbs:function(a){$(".thumb a").hover(function(b){$(".image_overlay",this).stop().animate({opacity:"1"},"fast")},function(){$(".image_overlay",this).stop().animate({opacity:"0"},"fast")}).children("img").after($('<div class="image_overlay"></div>').css({opacity:"0",visibility:"visible"}));$(".thumb a").click(function(b){b.preventDefault();hs.expand(this,{src:this.getAttribute("href"),outlineType:"rounded-white",dimmingOpacity:0.75,align:"center"})},false);$(".printBtn").click(function(b){$("#screen-overlay").show();$("#print-window").show(function(){$("#print-window .btnDownload").click(function(){IdoleSite.Card.togglePrint()})})})},changeFavorite:function(a){},setupFavorites:function(c,b,a){},getViewPort:function(){return{height:$(window).height(),width:$(window).width()}},handleResize:function(a){var b=IdoleSite.Card.offset;$(".previewContainer").width(a.width-270);$(".jspPane").width(a.width-270);$(".scroll-pane").jScrollPane({showArrows:true})}},initialized:false,init:function(c,b){if(!b){b={}}switch(c){case"card":IdoleSite.Card.init(b);break;default:IdoleSite.config=b;$(window).resize(function(){$(".previewContainer").height($(this).height()-b.offset)}).resize();IdoleSite.doView(IdoleSite.getView(),false);$("input#search_Box").autocomplete({source:b.modelData,select:function(f,d){$(this).hide();window.location="card.php?id="+d.item.value}});$(".viewBtn").click(function(){var d=IdoleSite.getView();if(d==0){IdoleSite.doView(1,true)}else{if(d==1){IdoleSite.doView(0,true)}}})}IdoleSite.setupFav();var a=$("<div/>",{id:"screen-overlay"});$("body").append(a);IdoleSite.initialized=true},doView:function(b,d){if(b==0){$("#imageFlowContainer").empty().height(0);$(".image-nav").hide();$(".mainThumbContainer").fadeIn("slow");$(".viewBtn").text("Advanced View");$(".previewContainer").css({overflowY:"auto"}).height($(window).height()-IdoleSite.config.offset).scrollTop(0);$(".thumb").hover(function(f){$(this).children("div").stop().animate({height:"50"},"fast");if(Core.isIE){return}else{$(this).find("div").css("background","rgba(0,0,0,0.6)")}},function(){$(this).children("div").stop().animate({height:"35"},"fast");if(Core.isIE){return}else{$(this).find("div").css("background","rgba(0,0,0,0.4)")}});if(d){Cookie.create("viewCookie_main",0,{path:"/",expires:8760})}return}if(b==1){$(".image-nav").show();$(".previewContainer").css({overflowY:"hidden",overflow:"hidden"});$(".viewBtn").text("Simple View");$(".mainThumbContainer").fadeOut();$(".mainThumbContainer img").each(function(g,j){var f=$(this).parent().parent().find("div").text();var k=$(this).parent().attr("href");var h=$("<img/>",{src:j.src}).attr("height","200").attr("alt",f).attr("longdesc",k);$("#imageFlowContainer").append(h)});var c=true;if(IdoleSite.config.isPortfolio){c=false}var a=new ImageFlow();a.init({ImageFlowID:"imageFlowContainer",opacity:false,circular:c,xStep:100,imageFocusMax:5,reflections:false,slider:false,onClick:function(f){window.location=this.longDesc}});if(d){Cookie.create("viewCookie_main",1,{path:"/",expires:8760})}return}},getView:function(){var a=Cookie.read("viewCookie_main");if(a==null){return 0}else{return a}},setupFav:function(a){var b=Cookie.read("resFavCookie");b=(b!=null)?decodeURIComponent(b).split(","):[];if(b.length>=1){$(".ui-favMenu").empty();$(b).each(function(){var c=arguments[1].split(":");$(".ui-favMenu").append('<li><a href="card.php?id='+c[0]+'">'+c[1]+"</a></li>")});if(!a){$("#nav div.dropdown").each(function(f,c){var d=$(c);d.parent().bind("mouseenter mouseleave",function(e){if(e.type=="mouseenter"){d.slideDown();d.parent().addClass("menuhover")}if(e.type=="mouseleave"){d.hide();d.parent().removeClass("menuhover")}})})}}}};var Cookie={cache:{},isLocalStorage:null,create:function(d,e,b){b=$.extend({},b);b.expires=b.expires||1;if(typeof b.expires=="number"){var a=b.expires;b.expires=new Date();b.expires.setTime(b.expires.getTime()+(a*3600000))}var c=[encodeURIComponent(d)+"=",b.escape?encodeURIComponent(e):e,b.expires?"; expires="+b.expires.toUTCString():"",b.path?"; path="+b.path:"",b.domain?"; domain="+b.domain:"",b.secure?"; secure":""];document.cookie=c.join("");if(Cookie.cache){if(b.expires==-1){delete Cookie.cache[d]}else{Cookie.cache[d]=e}}},read:function(c){if(Cookie.cache[c]){return Cookie.cache[c]}var a={};var d=document.cookie.split(";");if(d.length>0){for(var b=0;b<d.length;b++){var e=d[b].split("=");if(e.length>=2){a[$.trim(e[0])]=e[1]}}}Cookie.cache=a;return a[c]||null},erase:function(a){Cookie.create(a,true,{expires:-1})}};var ToolTip={wrapper:null,responseCache:{},current:null,contents:null,visible:false,initialized:false,args:{location:"mouse"},initialize:function(){var a=$("<div/>").addClass("tooltip-ui").appendTo("body");ToolTip.contents=$("<div/>").addClass("tooltip-content").appendTo(a);ToolTip.wrapper=a;ToolTip.initialized=true},show:function(d,b,a){if(!ToolTip.wrapper){ToolTip.initialize()}if(!a){a={}}a=$.extend({},ToolTip.args,a);ToolTip.current=d=$(d);if(a.location==ToolTip.args.location&&d.offset().left>$(window).width()/2){a.location="topLeft"}d.mouseout(function(){ToolTip.hide()});if(typeof b==="object"){ToolTip.position(d,b,a.location)}else{if(typeof b==="string"){if(b.substr(0,1)==="#"){ToolTip.position(d,$(b).html(),a.location)}else{if(a.formatDate){b=ToolTip.formatDate(b)}ToolTip.position(d,b,a.location)}}}},hide:function(){if(!ToolTip.wrapper){return}ToolTip.wrapper.hide();ToolTip.wrapper.unbind("mousemove.tooltip");ToolTip.current=null;ToolTip.visible=true},position:function(g,f,b){if(!ToolTip.current){return}if(typeof f=="string"){ToolTip.contents.html(f)}else{}var d=ToolTip.wrapper.outerWidth(),a=ToolTip.wrapper.outerHeight(),e=ToolTip["_"+b](d,a,g);if(e){ToolTip.move(e.x,e.y,d,a)}},move:function(a,d,b,c){ToolTip.wrapper.css("left",a+"px").css("top",d+"px").show();ToolTip.visible=true},_topLeft:function(c,b,d){var e=d.offset(),a=e.left-c,f=e.top-b;return{x:a,y:f}},_topRight:function(d,b,e){var f=e.offset(),c=e.outerWidth(),a=f.left+c,g=f.top-b;return{x:a,y:g}},_mouse:function(b,a,c){c.unbind("mousemove.tooltip").bind("mousemove.tooltip",function(d){ToolTip.move((d.pageX+10),(d.pageY+10),b,a)})}};var FileUpload={initialized:false,initialize:function(a){FileUpload.initialized=true}};var Validator={initialized:false,form:null,config:null,currentSection:null,sections:[],fieldData:null,maxLen:30,maxFile:3,curFile:1,fileGroup:"userfile[]",strings:["Please fill in some details about yourself.  If you are a Woman between 1m74/1m80 or a Man between 1m84-1m90 and you are between the ages 16 and 22.","You may send upto 3 pictures. Please make sure that they are either JPG, GIF or PNG and that they are less then 2mb each. Candidates without pictures will not be accepted."],initialize:function(b,a){Validator.initialized=true;Validator.currentSection=0;Validator.fieldData=a;Validator.config=b;Validator.setupForm(b.form)},submit:function(){},handleFileSelect:function(d){var b=Validator.curFile;var a=Validator.maxFile;var c=$(d.target).val();var f=/.\.(jpe?g||gif||png)$/i.test(c);if(b<=a){if(f){d.target.style.left="-1000px";if(b!=a){Validator.addFileSelect()}Validator.curFile++;Validator.addFile(c)}else{alert("You can only upload picture files JPG, GIF and PNG")}}},addFile:function(a){$(".cur-file").html(Validator.curFile-1);$(".files-container ul").append("<li><span>"+a+"</span></li>")},removeFile:function(){},addFileSelect:function(c){var b=Validator.curFile;var a=document.createElement("input");a.type="file";a.className="file-upload";a.id="file_"+b;a.name="userfile[]";$(a).change(Validator.handleFileSelect);$(".upload-section").append(a)},goNext:function(b){var d=Validator.currentSection;var a=Validator.sections;if(d<a.length-1){if(Validator.validate(d)){$(a[d].el).hide();$(a[d].tabEl).removeClass("selected");$(a[d+1].el).show();$(a[d+1].tabEl).addClass("selected");Validator.currentSection=d+1;if(Validator.currentSection==a.length-1){$(b.target).val("Submit").unbind("click").click(function(c){$(Validator.form).submit()});$(".info-bar").html(Validator.strings[1])}}}},setupForm:function(a){Validator.form=$(a);$(".upload-section").find("input[type=file]").val("").change(Validator.handleFileSelect);$(".info-bar").html(Validator.strings[0]);$(".formPrevBtn").click(function(d){var f=Validator.currentSection;var b=Validator.sections;if(f>0){$(b[f].el).hide();$(b[f].tabEl).removeClass("selected");$(b[f-1].el).show();$(b[f-1].tabEl).addClass("selected");Validator.currentSection=f-1}if(f<b.length){$(".info-bar").html(Validator.strings[0])}if(f==b.length-1){$(".formNextBtn").val("Next").unbind("click").click(Validator.goNext)}});$(".formNextBtn").click(Validator.goNext);$(a+" .form-section").each(function(d,c){Validator.sections.push({tabEl:$(".form-nav li")[d],el:c,table:$(".form-table")[d]})})},validate:function(e,d){var b=Validator.fieldData;var c=Validator.sections;var a=[];$(c[e].table).find(":input").each(function(g,f){$.each(b,function(h,i){if(i.field==f.id){if(!Validator.checkValidate(i,f)){a.push({field:f})}else{$(i.field).unbind("change",false);Validator.hideError(f.id)}}})});if(a.length>0){$.each(a,function(f,g){$(g.field).unbind("change",false);$(g.field).bind("change",function(h){Validator.validate(Validator.currentSection)});Validator.showError(g.field.id)});return false}return true},showError:function(b,c){var a=b+"_label";$("#"+b).addClass("field-error");$("div.error").each(function(e,d){if(d.id==a){$(d).show()}})},hideError:function(b,c){var a=b+"_label";$("#"+b).removeClass("field-error");$("div.error").each(function(e,d){if(d.id==a){$(d).hide()}})},checkValidate:function(e,b){switch(e.type){case"string":var f=/^[A-Za-z0-9 ]{3,20}$/;var d=$(b).val();if(f.test(d)){return true}break;case"string2":var d=$(b).val();if(d.length>3){return true}case"email":var c=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;var d=$(b).val();if(c.test(d)){return true}break;case"combo":if($(b).val()!=0){return true}case"tel":var a=/^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/}return false}};(function(c){var d=function(){var e={email:{check:function(g){if(g){return f(g,"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])")}return true},msg:"Enter a valid e-mail address."},url:{check:function(g){if(g){return f(g,"^https?://(.+.)+.{2,4}(/.*)?$")}return true},msg:"Enter a valid URL."},required:{check:function(g){if(g){return true}else{return false}},msg:"This field is required."}};var f=function(i,h){var g=new RegExp(h,"");return g.test(i)};return{addRule:function(g,h){e[g]=h},getRule:function(g){return e[g]}}};var b=function(f){var e=[];f.find("[validation]").each(function(){var g=c(this);if(g.attr("validation")!==undefined){e.push(new a(g))}});this.fields=e};b.prototype={validate:function(){for(field in this.fields){this.fields[field].validate()}},isValid:function(){for(field in this.fields){if(!this.fields[field].valid){this.fields[field].field.focus();return false}}return true}};var a=function(e){this.field=e;this.valid=false;this.attach("change")};a.prototype={attach:function(e){var f=this;if(e=="change"){f.field.bind("change",function(){return f.validate()})}if(e=="keyup"){f.field.bind("keyup",function(g){return f.validate()})}},validate:function(){var f=this,k=f.field,h="errorlist",m=c(document.createElement("span")).addClass(h),g=k.attr("validation").split(" "),e=k.parent(),l=[];k.next(".errorlist").remove();for(var i in g){var j=c.Validation.getRule(g[i]);if(!j.check(k.val())){e.addClass("error");l.push(j.msg)}}if(l.length){f.field.unbind("keyup");f.attach("keyup");k.after(m.empty());for(error in l){}f.valid=false}else{m.remove();e.removeClass("error");f.valid=true}}};c.extend(c.fn,{validation:function(){var e=new b(c(this));c.data(c(this)[0],"validator",e)},validate:function(){var e=c.data(c(this)[0],"validator");e.validate();return e.isValid()}});c.Validation=new d()})(jQuery);
