/** 
 * Copyright (c) 2007-2010 Onlime Webhosting (http://www.onlime.ch)
 * Author: Philip Iezzi
 *
 * JQuery UI elements setup
 */
$(document).ready(function(){
	
    $("a.fancybox").fancybox({
        'overlayOpacity' : 0.6,
        'centerOnScroll' : true,
        'scrolling'      : 'no'
    });

    $("a.fancyframe").fancybox({
        'frameWidth'     : 430,
        'frameHeight'    : 365,
        'centerOnScroll' : true,
        'scrolling'      : 'no'
    });

	/*
	$('.collapse .heading').each(function()
    {
        $(this).click(function() {
            $(this).next().toggle('blind', null, 'fast');
            return false;
        }).next().hide();
    });
    */
    
    $("button").button();
    $("input:submit").button();


    // http://www.downloadjavascripts.com/list/javasitevv74/Details.aspx
    // http://nettuts.s3.amazonaws.com/011_jQuerySite/sample/index.html
//    var hash = window.location.hash.substr(1);
//    var href = $('#topmenu li a').each(function(){
//            var href = $(this).attr('href');
//            if(hash==href.substr(0,href.length)){
//                    var toLoad = hash+' #content';
//                    alert(toLoad);
//                    $('#content').load(toLoad)
//            }
//    });
//
//    $('#topmenu li a').click(function(){
//
//            var toLoad = $(this).attr('href')+' #content';
//            $('#content').hide('fast',loadContent);
////            $('#load').remove();
////            $('#wrapper').append('<span id="load">LOADING...</span>');
////            $('#load').fadeIn('normal');
//            window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length);
//            function loadContent() {
//                    $('#content').load(toLoad,'',showNewContent())
//            }
//            function showNewContent() {
//                    $('#content').show('normal',hideLoader());
//            }
//            function hideLoader() {
//                    $('#load').fadeOut('normal');
//            }
//            return false;
//
//    });
    
});

/*
 * Show/hide Zend_Form field elements
 */

function hideElements(arr) {
    $.each(arr, function(index, value) {
        // hide both field and label
        $('#' + value + '-element').hide();
        $('#' + value + '-label').hide();
    });
}

function showElements(arr) {
    $.each(arr, function(index, value) {
        // show both field and label
        $('#' + value + '-element').show();
        $('#' + value + '-label').show();
    });
}

