function openPopup(url,name,size){
	popup = window.open(url, name, size);
	popup.focus();
}
function openMediaPlayer(movie){
	var url = "/videos/mediaplayer.cfm?movie=" + movie;
	mediaplayer = window.open(url, "mediaplayer", "width=510, height=400");
	mediaplayer.focus();
}
function getDestination(){
	if(getRadio(document.theform,"destination") != ""){
		getUrl('../content/' + getRadio(document.theform,"destination") + '.htm');
	}
	else {
		alert("Please select a destination");
	}
}
function checksearchStr(){
	if(document.ecard.sendername.value == document.ecard.sendername.alt){
		document.ecard.sendername.value = "";
	}
	if(document.ecard.recipentemail.value == document.ecard.recipentemail.alt){
		document.ecard.recipentemail.value = "";
	}
}
function create_mail(name, domain, tld, label, subject) {
    var mail = "";
    mail += '<a class="email" href="' + 'ma' + 'il' + 'to:' + name;
    mail += '&#64;' + domain + '.' + tld;
    mail += '?subject=' + subject;
	if(label != "")
		mail += '">' + label + '<' + '/a>';
	else
		mail += '">' + name + '&#64;' + domain + '.' + tld + '<' + '/a>';
    document.write(mail);
}
function doSearch(obj){
	var form = jQuery(obj).closest('form');
	jQuery(form).trigger("submit");
}
function clearSearch(obj){
	var form = jQuery(obj).closest('form');
	jQuery(form).find("input[name=search]").val('');
	jQuery(form).trigger("submit");
}
var formBox;
function showInfos(){
	if(arguments[0])
		jQuery("input[name=recorduid]").val(arguments[0]);
	formBox = new Boxy("#contactform", {
		title: jQuery("#contactform").attr("title"),
		closeText: jQuery("#contactform").attr("rel")
	});
}
function sendInfos(obj){
	var form = jQuery(obj).closest('form');
	if(arguments[1])
		action = arguments[1];
	if (form.length) {
		if (checkForm(form)) {
			removeHints(form);
			$.ajax({
				type: 'POST',
				url: jQuery(form).find("input[name=formaction]").val(),
				data: $(form).serialize(),
				success: function(response){
					if (response.status == "ok") {
						try{
							formBox.hideAndUnload();
						}
						catch(err){
							
						}
						$(form)[0].reset();
						confirmBox = new Boxy("#confirmmsg", {
							title: jQuery("#confirmmsg").attr("title"),
							closeText: jQuery("#confirmmsg").attr("rel")
						});
						window.setTimeout('confirmBox.hideAndUnload()',5000);
					}
				},
				dataType: 'json'
			});
		}
	}
}
$().ready(function() {
	var originalFontSize = $('.original').css('font-size');
	
	Cufon.set('Garamond').replace(".title")(".subtitle");
	Cufon.replace(".maintitle", { fontFamily: 'HelveNueThin' });
	jQuery(".maintitle").show();
	Cufon.replace(".quote", { fontFamily: 'HelveNueThin' });

    $("ul.menu li a").hover(function() {
		$(".pathnav ul").hide();
        $(this).parent().find("ul.subnav").slideDown('fast').show();
  
        $(this).parent().hover(function() {  
	        }, function(){
				
	            $(this).parent().find("ul.subnav").slideUp('slow');
	            $(".pathnav ul").show(); 
	        });
        }).hover(function() {  
            $(this).addClass("subhover");
        }, function(){
            $(this).removeClass("subhover");
    });
	$("ul.sitetools li a").hover(function() {
        $(this).parent().find("ul.subnav").slideDown('fast').show();
  
        $(this).parent().hover(function() {  
	        }, function(){
				
	            $(this).parent().find("ul.subnav").slideUp('slow');
	        });
        }).hover(function() {  
            $(this).addClass("subhover");
        }, function(){
            $(this).removeClass("subhover");
    });

	$('a.lightbox').lightBox();

	$(".resetFont").click(function(){
		var originalFontSize = parseFloat($('.original').css('font-size'));
		$.get("/ajax.cfm", {"interface.fontsize": originalFontSize }, function(response){
			if(response.status == "ok")
				$('.main').css('font-size', originalFontSize);
		}, "json");
		return false;
	});
	$(".increaseFont").click(function(){
		var currentFontSize = $('.main').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum * 1.2;
		if(newFontSize < 22)
			$.get("/ajax.cfm", {"interface.fontsize": newFontSize }, function(response){
				if(response.status == "ok")
					$('.main').css('font-size', newFontSize);
			}, "json");
		return false;
	});
	$(".decreaseFont").click(function(){
		var currentFontSize = $('.main').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum * 0.8;
		if(newFontSize > 8)
			$.get("/ajax.cfm", {"interface.fontsize": newFontSize }, function(response){
				if(response.status == "ok")
					$('.main').css('font-size', newFontSize);
			}, "json");
		return false;
	});
	$(function() {
		$( "#accordion" ).accordion({
			autoHeight: false,
			collapsible: true,
			navigation: true
		});
	});
});

