
/*
	Toby Brancher for Holler Sydney 2008
	 :: Credit always to Alasdair McLeay & Gijs Van de Hoorn
*/

$(function() {


    $('.id-navigation').bgiframe();

    $('.wrap ul li ul').holler_navigation({ setting: 'example' });
    
    // Movement vars
    var TT_additional = 'easeInOutQuad';
    var TS_additional = 680;

    // On Load
    $('#additional-advSearch').css({ opacity: 0 });
    $('#additional-advSearch').animate({ height: 'hide' }, 0, 'linear', function() {
        $('a.additional').removeClass('less').addClass('more');
        $('a.additional').html('More options');
    });


	// On Click - Navigation Advanced Search
	$('.id-search a').click(function(){
											   	
		var selectedLink = $(this);
		var selectedId = $("div.nav-advancedsearch")
		
		if(selectedLink.hasClass('show')) {
			
			//selectedLink.text("Hide This")
			
			selectedId.animate({opacity:1},2);
			  selectedId.queue(function () {
				selectedId.slideDown("slow");
				selectedId.dequeue();
			  });
				selectedId.slideDown();
				selectedLink.removeClass('hide').addClass('show');

				selectedLink.removeClass('show').addClass('hide');
		} else {

};
		

///return false;
	});
	
			// On Click - Navigation Advanced Search - Close
	$('.close a').click(function(){
											   	
		var selectedLink = $('.id-search a');
		var selectedId = $("div.nav-advancedsearch")
		
		

				selectedId.slideUp();

				selectedLink.removeClass('hide').addClass('show');
		
		return false;
	});


    // On Click
    $('a.additional').click(function() {

        var selectedLink = $(this);
        var selected_id = selectedLink.attr('href');
        var selectedId = $(selected_id);

        if (selectedLink.hasClass('more')) {
            selectedId.animate({ height: 'show', opacity: 1 }, TS_additional, TT_additional, function() {
                selectedLink.removeClass('more').addClass('less');
                selectedLink.html('Less options');
            });
        } else {
            selectedId.animate({ height: 'hide', opacity: 0 }, TS_additional, TT_additional, function() {
                selectedLink.removeClass('less').addClass('more');
                selectedLink.html('More options');
            });
        };
        return false;
    });

    $.ajaxHistory.initialize();

});

/*
	Re-used functions
*/

var win= null; // (screen.width-w)/2;
function popUp(mypage,myname,w,h,scroll){
  var winl = 50;
  var wint = 50;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
	
jQuery.fn.bgIframe = jQuery.fn.bgiframe = function() {
	// This is only for IE6
	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	
	if ( !(jQuery.browser.msie && (ie55 || ie6)) ) return this;
	var html = '<iframe class="bgiframe" src="javascript:;" tabindex="-1" '
	 					+'style="display:block; position:absolute; '
						+'top: expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)  || 0) * -1) + \'px\'); '
						+'left:expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth) || 0) * -1) + \'px\'); ' 
						+'z-index:-1; filter:Alpha(Opacity=\'0\'); '
						+'width:expression(this.parentNode.offsetWidth + \'px\'); '
						+'height:expression(this.parentNode.offsetHeight + \'px\')"/>';
	return this.each(function() {
		if ( !jQuery('iframe.bgiframe', this)[0] )
			this.insertBefore( document.createElement(html), this.firstChild );
	});
};


/**
 * History/Remote - jQuery plugin for enabling history support and bookmarking
 * @requires jQuery v1.0.3
 *
 * http://stilbuero.de/jquery/history/
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 0.2.3
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(2($){$.D=16 2(){4 c=\'15\';4 k=7.5;4 e=A;4 g;6.o=2(){};4 h=2(){$(\'.x-S\').1j()};$(8).L(c,h);3($.t.19){4 f,p=q;$(2(){f=$(\'<H 13="12: Z;"></H>\').E(8.V).1p(0);4 a=f.C.8;a.I();a.O();3(k&&k!=\'#\'){a.7.5=k.B(\'#\',\'\')}});6.o=2(a){k=a;4 b=f.C.8;b.I();b.O();b.7.5=a.B(\'#\',\'\')};g=2(){4 a=f.C.8;4 b=a.7.5;3(b!=k){k=b;3(b&&b!=\'#\'){$(\'a[@l$="\'+b+\'"]\').n();7.5=b}m 3(p){7.5=\'\';$(8).v(c)}}p=z}}m 3($.t.18||$.t.17){6.o=2(a){k=a};g=2(){3(7.5){3(k!=7.5){k=7.5;$(\'a[@l$="\'+k+\'"]\').n()}}m 3(k){k=\'\';$(8).v(c)}}}m 3($.t.14){4 d,r,u;$(2(){d=[];d.9=y.9;r=[]});4 j=q,p=q;u=2(a){d.G(a);r.9=0;j=q};6.o=2(a){k=a;u(k)};g=2(){4 b=y.9-d.9;3(b){j=q;3(b<0){F(4 i=0;i<11.10(b);i++)r.Y(d.X())}m{F(4 i=0;i<b;i++)d.G(r.W())}4 a=d[d.9-1];$(\'a[@l$="\'+a+\'"]\').n();k=7.5}m 3(d[d.9-1]==U&&!j){3(8.T.1o(\'#\')>=0){$(\'a[@l$="\'+\'#\'+8.T.1n(\'#\')[1]+\'"]\').n()}m 3(p){$(8).v(c)}j=z}p=z}}6.1m=2(a){3(w a==\'2\'){$(8).1l(c,h).L(c,a)}3(7.5&&w u==\'U\'){$(\'a[@l$="\'+7.5+\'"]\').v(\'n\')}3(g&&e==A){e=1k(g,1i)}}};$.Q.x=2(g,f,c){c=c||2(){};3(w f==\'2\'){c=f}f=$.1h({J:\'x-\'},f||{});4 d=$(g).1g()&&$(g)||$(\'<N></N>\').E(\'V\');d.1f(\'x-S\');M 6.1e(2(i){4 b=6.l,5=\'#\'+(6.R&&6.R.B(/\\s/g,\'1d\')||f.J+(i+1)),a=6;6.l=5;$(6).n(2(e){3(!d[\'K\']){3(e.P){$.D.o(5)}d.1c(b,2(){d[\'K\']=A;c.1b(a)})}})})};$.Q.y=2(a){M 6.n(2(e){3(e.P){$.D.o(6.5)}w a==\'2\'&&a()})}})(1a);',62,88,'||function|if|var|hash|this|location|document|length||||||||||||href|else|click|update|initialized|false|_forwardStack||browser|_addHistory|trigger|typeof|remote|history|true|null|replace|contentWindow|ajaxHistory|appendTo|for|push|iframe|open|hashPrefix|locked|bind|return|div|close|clientX|fn|title|output|URL|undefined|body|shift|pop|unshift|none|abs|Math|display|style|safari|historyReset|new|opera|mozilla|msie|jQuery|apply|load|_|each|addClass|size|extend|200|empty|setInterval|unbind|initialize|split|indexOf|get'.split('|'),0,{}))
