// JavaScript Document
$(document).ready(function(){
			/* ------ css aids for old browsers begins----------   */
			
			$("#slide_show #nav_cont #nav li:last").css("margin-right","0px");			
			$("ul#search_results li:odd h1 a").css("color","#006699");
			$("#top_menu ul li:last").css("border-right","0px");
			
			/* ------ css aids for old browsers ends----------   */
function animate_poll(){
                    $('.survey_image').each(
                        function(){
                            var o_width=$(this).attr("width");
                            $(this).attr("width","0");
                            $(this).animate({width:o_width+"px"},1500);
                    });
                }
                animate_poll();
                var survey;
                $("input[type='submit'][name='survey']").bind('click',survey_click);
                function survey_click(){
                    if($(this).val()=="Results")
                        survey="show_results";
                    else
                        survey="send_vote";
                    }
                function submit_function(e){
                        var option1;
                        var survey_id;
                        survey_id= $(this).children("input[name='survey_id']").val();
                        option1=$(this).children(".poll_option").children("input[name='check_option'][checked='true']").val();
                        var sub_data="survey_id="+survey_id+"&check_option="+option1+"&survey="+survey;
                        //alert(survey);
                        $("#survey_overlay").fadeIn(300);
                        $.ajax({
                           type: "POST",
                           contentType:"application/x-www-form-urlencoded; charset=windows-1256",
                           scriptCharset:"windows-1256",
                           dataType:"html",
                           processData:false,
                           type:"post",
                           url: "survey/survey.php",
                           data: sub_data,
                           success: function(msg){
                             //alert( "Data Saved: " + msg );

                            $("#serv .survey").remove();
                            $("#serv #votes").remove();
                            $('#serv').append(msg);
                            $("#survey_overlay").fadeOut(800);
                            //$('#serv').append(msg);
                            //$(this).css("display","none");
                            //alert(msg);
                            animate_poll();
                            $('.survey').bind('submit',submit_function);
                            $("input[type='submit'][name='survey']").bind('click',survey_click);
                            //alert(msg);
                           }
                         });
                        //return false;
                        return false;
                    }
            $('.survey').bind('submit',submit_function);			
		 	$("#nav_cont").stop().animate({opacity:0.7 }, 0 );			
			$('#s3').cycle({				   
				   fx: 'fade',
				   sync: 1,
				   timeout: 6000,
				   next:"#next",
				   prev:"#prev",
				   speed:2000,
				   /*easing:'easeOutQuint',*/
				   cssBefore: {top:0,left: -335,display: 'block','background':'none'},
				   cssAfter: {'background':'none'},
				   animIn:{left:0},
				   animOut:{top: 260},
				   /*delay: 4000 ,*/
				   /*before: function () {$(".main_news_snippet").stop().animate({ bottom:-200,opacity:0.7 }, 100 );},
				   after: function (){$(".main_news_snippet").stop().animate({ bottom:0,opacity:0.7 }, 500 );},*/
				   pager:'#nav',pagerEvent:'mouseover',pauseOnPagerHover:true,	pagerAnchorBuilder: function(idx, slide){
            return '#nav li:eq(' + (idx) + ') a';}	});
            /*$('#photos').galleryView({
            panel_width: 585,
            panel_height: 225,
            frame_width: 75,
            frame_height: 50,
            background_color: 'transparent',
            border: 'none',
            nav_theme: 'light',
            easing: 'easeInOutQuad',
            pause_on_hover: true

            });*/
			});