var originalphotos = false;
function openWindow(_URL,_width,_height,_scrollbars) {
    var _left=(screen.availWidth/2)-(_width/2);
    var _top=(screen.availHeight/2)-(_height/2);
    window.open(_URL,"popupWindow","directories=no,menubar=no,location=yes,resizable=yes,scrollbars="+_scrollbars+",status=no,toolbar=no,height="+_height+",width="+_width+",left="+_left+",top="+_top);
}
$(document).ready(function(){

	// Rollover Images
	$('.menu img').hover(
		function() {src = $(this).attr('src'); $(this).attr('src',src.replace(/off\./,'on.'));},
		function() {src = $(this).attr('src'); $(this).attr('src',src.replace(/on\./,'off.'));}
	);

	$('.photos').cycle({
        random:false,
        startingSlide: 2,
        next:'.photos',
        timeout:3000,
        speed:400,
        requeueOnImageNotLoaded: true
    });

	$('.logo').click(function(){window.location.href='/';}).css('cursor','pointer');
	$('.votedbest').click(function(){openWindow('http://wrtv.cityvoter.com/Details.aspx?business=33558',825,600,'yes');}).css('cursor','pointer');

	// Collection Zoom
	$('.collections .photo img').hover(function(){
        if(originalphotos == false) {
            originalphotos = $('.photos').html();
        }
		var filename = $(this).attr('src');
		filename = filename.replace(/thumbnails\//,'');
		$('.photos').html('<img src="'+filename+'" />');
	}, function(){
        $('.photos').html($('.photos').html()+originalphotos);
        $('.photos').cycle({
            random:false,
            timeout:3000,
            speed:400,
            requeueOnImageNotLoaded: true
        });
    });

    setTimeout(function(){
        $('.featured-client-instructions').html('~ Click Photos To View More ~');
        $('.featured-client').css('visibility','visible');
        $('.featured-client').cycle({
            cleartype: !$.support.opacity,
            fx:'scrollLeft',
            next:'.featured-client',
            timeout:10000,
            requeueOnImageNotLoaded: true,
            requeueTimeout: 250
        });
        document.location.href = '#featured-client';
    },3000);

});