$().ready(function() {
    $('#coda-slider-1').codaSlider(objCodaSettings);
    /* lijoyX */
    $("#coda-slider-1 ").append($("#coda-nav-1").css({
        "width":"",
        "position":"absolute",
        "right":"0px",
        "bottom":"0px"
    })
    );

    //set width of ul
    if($.browser.msie){
        $("#coda-nav-1").css({
            "left":"-40px"
        });
    }
    
    $("#coda-nav-1").width("100%");
    $("#coda-nav-1 ul").find("li").each(function(cnt){
        $(this).css({
            "opacity":"0.85",
            "filter":"alpha(opacity=85)"
        });


        if(cnt==0 || cnt==1){
            //Jumerira Mosque Visit
            $(this).width("125px").find("a").css("width","inherit");
        }
        else if(cnt==2){
            //Cultural Breakfasts & Lunches
            $(this).width("125px").find("a").css("width","inherit");
        }
        else if(cnt==3){
            //Bastakiya Tours
            $(this).width("80px").find("a").css("width","inherit");
        }
        else if(cnt==4){
            //Cultural Breakfasts & Lunches
            $(this).width("130px").find("a").css("width","inherit");
        }
        else if(cnt==5){
            //Cultural Breakfasts & Lunches
            $(this).width("79px").find("a").css("width","inherit");
        }

        /* Making it 2 line */
        $(this).find("a").html($(this).find("a").css({
            "text-align":"center"
        }).html().replace(/###/g,"<br>"));

      

        /* Adding links */
        switch(cnt){
            case 0:
                // $(this).remove();// this is to show the first image on the front page and then removes it
                $(this).css("display","none");
                break;
            case 1:
                $(this).attr("goto", "./jumeirah_mosque_visit.php");
                break;
            case 2:
                $(this).attr("goto", "./cultural_lunch.php");
                break;
            case 3:
                $(this).attr("goto", "./bastakia_heritage.php");			
                break;
            case 4:
                $(this).attr("goto", "./cultural_discovery.php");					
                break;
            case 5:
                $(this).attr("goto", "./spoken_arabic.php");				
                break;
        }
        
        /* Adding links on click */
        $(this).find("a").click(function(){
            location.replace($(this).parent().attr("goto"));
        });

    });
    //Essential for msie
    if($.browser.msie==true){
        $("#coda-nav-1 ul").css({
            "display":"block"
        });
    }else{
        $("#coda-nav-1 ul").css({
            "display":"inline"
        });
    }

    //Disable mouse right click
    $(document)[0].oncontextmenu = function() {
        alert('Copyright 2011 \nSMCCU, Dubai, UAE \nAll rights reserved')
        return false;
    }  
   
});

/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
$(function(){
    DoValidateSearch2(1);
});

var curpage="";
function DoValidateSearch2(pageno)
{
    if(pageno != null)
        $("#PageNo").val(pageno);

    curpage = pageno;
    var myfrmval="";


    /*	$.fn.autoscroll.defaults = {
	   start: {
		  step: 50,
		  scroll: true,
		  direction: "down"
	   },
	   delay: 5000,
	   ffrw: {
		  speed: "fast",
		  step: 100
	   }
	}; 
	settings=
	
	{
	   direction: "down",
	   step: 50,
	   scroll: true,
	   onEvaluate: function () {
		  // code
	   },    onEdge: function (edge) {
		  // code
	   }
	} */
    //$("#divListResultAll").autoscroll([settings]);


    $("#divListResultAll").html(gStrAjaxImgSmall);
    $.ajaxSetup(
    {
        timeout:100000,
        dataType:"text",
        error:function(xhr)
        {
            mfnShowMessage(xhr.statusText, "ERR", 30);
        }
    }
    )
    //ajax call
    $.post("services/gallery_all.php",myfrmval,
        function(data)
        {
            $("#divListResultAll").html(data);
            fnSkinJcarousel()
            return false;
        }
        )
    return false;
}

function fnSkinJcarousel(){
    $('#mycarousel').jcarousel({
        vertical: true,
        auto: 5,
		animation:3000,
        wrap: 'last'
    });
}
