/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function()
{

//    $('#jsddm > li').bind('mouseover', jsddm_open);
//    $('#jsddm > li').bind('mouseout',  jsddm_timer);
  
$('#seoHolder').html($('#seoTerm').html());
$('#seoTerm').remove();


       $('a[rel="lightbox"]').lightBox({fixedNavigation:true});

         
       
});

function fadeIN(item){
				$(item).children().fadeOut('slow');
				$(item).animate({borderColor:'white'},2000);
			}
			
			function fadeOUT(item){
				$(item).children().fadeIn('slow');
				$(item).animate({border:'black'},2000);
			}

            
function animateStripe(stripe,value){
       
    if(value==1){
        $('#stripe'+stripe).animate({
            left: '-400'
        },300,'linear',function(){});
    }else if (value==2){
        $('#stripe'+stripe).animate({
            left: '-200'
        },300,'linear',function(){});
    }else if (value==3){
        $('#stripe'+stripe).animate({
            left: '0'
        },300,'linear',function(){});
    }
}

function getFileName(fileName){
    var name = fileName.substring(fileName.indexOf('/')+1,fileName.indexOf('.'));
    return name;
}


function highlight(thiss,stripe,value){


    var fileName = '';

    var photoClass = $(thiss).attr('class');//Get the class for this set of photos

    $('.'+photoClass).each(function(){//Use the class name to loop through all the photos

        fileName=getFileName($(this).children().attr('src'));//For each photo get its filename

        if(fileName.indexOf('on')==-1){//The picture is off we dont do anything

        }else{//The picture is on we need to turn it off
            $(this).children().attr('src','images/'+fileName.substring(0,fileName.length-2)+'.jpg');
        }

    });

    //Now all the images are off, we can highlight our moused over one


    fileName=getFileName($(thiss).children().attr('src'));//Get this pictures filename

    $(thiss).children().attr('src','images/'+fileName+'on.jpg');//We already know it's off so we just add on to the filename

    animateStripe(stripe,value);

}




var timeout         = 500;
var closetimer      = 0;
var ddmenuitem      = 0;

function jsddm_open()
{
    jsddm_canceltimer();
    jsddm_close();
    ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');
}

function jsddm_close()
{
    if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
}

function jsddm_timer()
{
    closetimer = window.setTimeout(jsddm_close, timeout);
}

function jsddm_canceltimer()
{
    if(closetimer)

    {
        window.clearTimeout(closetimer);
        closetimer = null;
    }
}



document.onclick = jsddm_close;


function highlightGal(thiss,stripe,value){

var thissClass = $(thiss).attr('class');


 $('.'+thissClass).each(function(){
        $(this).children().animate({'opacity':'0.5','filter':'alpha(opacity=50)','z-index':'0'},5);
    });
    $(thiss).children().animate({'opacity':'1','filter':'alpha(opacity=100)','z-index':'0'},1000);

    

    animateStripe(stripe,value);

}
