/* Project Name Global Javascript Functions

By  - ISITE Design

*/

// existing functions 
function openChild(file,window) {
	childWindow=open(file,window,'resizable=yes,toolbar=yes,location=yes,directories=no,status=no,scrollbars=yes,width=900,height=400,scroolbar=true');
	if (childWindow.opener == null) 
	    childWindow.opener = self;
    childWindow.focus();
}
function openMap(file,window) {
	childWindow=open(file,window,'resizable=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,width=559,height=411,scroolbar=true');
	if (childWindow.opener == null) 
	    childWindow.opener = self;
    childWindow.focus();
}
function premiumListingExternalRedirect (url, PremiumID){
 	childWindow=open('/Redirect.aspx?url='+url+ '&PremiumID=' +PremiumID,"Travel_Alaska_Partner_Site" ,'resizable=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,width=900,height=800,scroolbar=true');
	if (childWindow.opener == null) 
	    childWindow.opener = self;
    childWindow.focus();
}


//start the jQuery functions
$(document).ready(function() {

	/*apply to the header search input - add as needed*/
//	$("#search").inputClear();


	/* add class to drop downs and buttons for IE <6 */
	if(document.all){
	    $("#nav li, button, a.button").hover(
	            function() { $(this).addClass("over"); }
				,
	            function() { $(this).removeClass("over"); }
	    );
	}// if document.all
    
    
    // swfobject in the flash component 
    if ($('#primaryflash').length > 0) { 
        var so = new SWFObject("http://travelalaska.dawleyassociates.com/_resources/_flash/taNew.swf", "flash", "920", "335", "8", "#ffffff", 'high'); 
        so.addParam("wmode", "transparent"); 
		so.addParam("allowScriptAccess", "always");
        so.write("primaryflash"); 
    }
    
	// hide anything with the class jshidden
	$(".jshidden").hide();
    $(".jsshow").show();
    
    // picfloat detail hiding
    $("div.picfloat div.details").hide();
    $("div.picfloat a.enlarge").click(function () {
        var details = $(this).next();
        
        if (details.is('div.details')) {
            if (details.is(':visible')) {
                details.hide();
            } else {
                details.show();
            }
        }
        
        return false;
    });
    
    // picfloat fix wide captions (todo)
    //$("div.picfloat>img").each(function() { $(this).parent().css("width", this.scrollWidth); } );    
    
});// document ready / end jquery functions


	/*clear search field on click - made into plugin so it can easily be used more than once.*/
	jQuery.fn.inputClear = function() {
		return this.focus(function() {
			if( this.value == this.defaultValue ) {
				this.value = "";
			}
		}).blur(function() {
			if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		});
	};
    


    
