//-----Navigation Menu Script
function initMenus() {


    $('#login').colorbox({
        initialWidth:"600px",
        initialHeight:"300px",
        height:"400px",
        width:"650px",
        transition:"none",
        speed:0,
        iframe:true,
        scrolling:false
    });
  
    $('#login2').colorbox({
        initialWidth:"600px",
        initialHeight:"300px",
        height:"400px",
        width:"650px",
        transition:"none",
        speed:0,
        iframe:true,
        scrolling:false
    });
  
    //$('.memberProfile').colorbox({initialWidth:"600px",initialHeight:"600px",height:"700px", width:"650px",transition:"none",speed:0, iframe:true, scrolling:false});

    /*
    $('.boardProfile').colorbox({
        initialWidth:"600px",
        initialHeight:"600px",
        height:"700px",
        width:"650px",
        transition:"none",
        speed:300,
        iframe:true,
        scrolling:false
    });
    */

    $('ul.menu ul').hide();
    $.each($('ul.menu'), function(){
        $('ul.expand').show();
    });
  
  
    $('.navSection').click(
        function() {
            var checkElement = $(this).next();
            var parent = this.parentNode.parentNode.id;

            if($('#' + parent).hasClass('noaccordion')) {
                $(this).next().slideToggle('normal');
                return false;
            }

            if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
                if($('#' + parent).hasClass('collapsible')) {
                    $('#' + parent + ' ul:visible').slideUp('normal');
                }
                return false;
            }
      
            if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
                $('#' + parent + ' ul:visible').slideUp('normal');
                checkElement.slideDown('normal');
                return false;
            }
        }
        );
}

//Handle Polls
function votePoll(poll){

    //get the selected value
    var poll=poll;
    var pollAnswerId;

    pollAnswerId = $("input[name="+poll+"]:checked").val();

    //poll id and poll answer now setup - do ajax query

    $(function(){
        //build data to be posted to ajaxPoll.php

        var theData="cmd=vote&pollId="+encodeURI(poll)+"&pollAnswerId="+encodeURI(pollAnswerId);
        //post to ajaxElement.php
        $.post("ajaxPoll.php", theData, function(theResponse){
            $("#"+poll).html(theResponse);
        });
    });

}


function showPoll(poll){

    //get the selected value
    var thePoll=poll;
        
    //poll id and poll answer now setup - do ajax query

    $(function(){
        //build data to be posted to ajaxPoll.php

        var theData="cmd=show&pollId="+encodeURI(thePoll);
        //post to ajaxElement.php
        $.post("ajaxPoll.php", theData, function(theResponse){
            //alert(thePoll);
            $("#poll"+thePoll).html(theResponse);
        });
    });

}

//Header Flash
  
/*
  var params = {};
  params.wmode = "transparent"; 
  
  swfobject.embedSWF("banner.swf", "flashHeaderWrapper", "730", "185","9.0.0","",params);
  
  */
  
// FLASH BANNER
// cache buster
var cacheBuster = "?t=" + Date.parse(new Date());
// stage dimensions		
var stageW = "728";//"100%";
var stageH = "185";//"100%";
			
			
// ATTRIBUTES
var attributes = {};
attributes.id = 'flashHeaderWrapper';
attributes.name = 'flashHeaderWrapper';

// PARAMS
var params = {};
params.bgcolor = "#ffffff";
params.menu = "false";
params.scale = 'noScale';
params.wmode = "opaque";
params.allowfullscreen = "true";
params.allowScriptAccess = "always";			
			
			
/* FLASH VARS */
var flashvars = {};
			
/// if commented / delete these lines, the component will take the stage dimensions defined 
/// above in "JAVASCRIPT SECTIONS" section or those defined in the settings xml
flashvars.componentWidth = stageW;
flashvars.componentHeight = stageH;
			
/// path to the content folder(where the xml files, images or video are nested)
/// if you want to use absolute paths(like "http://domain.com/images/....") then leave it empty("")			
flashvars.pathToFiles = "cms/";

// path to content XML
flashvars.contentXMLPath = "banner.xml";


/** EMBED THE SWF**/
swfobject.embedSWF("flash/banner.swf"+cacheBuster, attributes.id, stageW, stageH, "9.0.124", "js/expressInstall.swf", flashvars, params, attributes);
  
    
  
  
function doFisheyeMenu(){

    $('#fish').Fisheye(
    {
        maxWidth: 10,
        items: 'a',
        itemsText: 'span',
        container: '.fisheyeContainer',
        itemWidth: 32,
        proximity: 80,
        halign : 'center'
    }
    )

}


function doCufon(){

    Cufon.replace('.cmsHeading', {
        fontFamily: 'Franklin Gothic Medium Cond'
    });
                  
    //Turn off navigation cufon for msie
    if(!$.browser.msie){
        Cufon.replace('.navSection', {
            fontFamily: 'Franklin Gothic Medium Cond'
        });
        Cufon.replace('.navSubSection', {
            fontFamily: 'Franklin Gothic Medium Cond'
        });
        Cufon.replace('.footerLink', {
            fontFamily: 'Franklin Gothic Medium Cond'
        });
    }


}
               
               
function makeGallery(){

    $("a[rel=gallery]").fancybox({
        'transitionIn'	:	'fade',
        'transitionOut'	:	'fade',
        'speedIn'		:	600,
        'speedOut'		:	200,
        'overlayShow'	:	true
    });


}


               
//Cufon Font Changes for theme
$(document).ready(function() {
         
    doCufon();
    initMenus();
    doFisheyeMenu();
    makeGallery();
			                            
});

