/*

	Vintage Rides - JavaScript
	
	Created On: 10th September, 2011
	Created By: Vikramjit R.Rai
	
	{techno:cats}

*/



$(document).ready(function () {

    /*Menu strap relocation*/
    relocateStrap(); // On Window Load
    $(window).resize(function () { relocateStrap(); }); // on Window Resize
    /**********************/


    /* HANDLE SUBMENU */
    $("#menu3").mouseover(function () {
        $("#subMenu3").show();
    });

    $("#menu3").mouseout(function () {
        $("#subMenu3").hide();
    });

    $("#menu4").mouseover(function () {
        $("#subMenu4").show();
    });

    $("#menu4").mouseout(function () {
        $("#subMenu4").hide();
    });


    /*************/


    activateHomepageCarousel(); // Homepage Image Carousel
    repositionPackage(); // Reposition Package

    //change BGcolor for radoi button click .....
$("#standard").click(function () { $(this).css("background-color", "#D2D2D2");
 $("#Confort").css("background-color", "transparent"); $("#Luxe").css("background-color", "transparent");})


 $("#Confort").click(function (event) { $(this).css("background-color", "#D2D2D2");
$("#standard").css("background-color", "transparent"); $("#Luxe").css("background-color", "transparent");  })


 $("#Luxe").click(function (event) { $(this).css("background-color", "#D2D2D2"); 
 $("#standard").css("background-color", "transparent"); $("#Confort").css("background-color", "transparent"); })

    // PDFdownload Form 
    $("#imgPDF1").click(function () { $("#divPDFs").dialog({ modal: true, position: 'center', width: '800', height: '180',}); });

    // slider form for call back form
    $("#callBackDiv").click(function () { $("#callBackForm").slideToggle("slow"); });

   function sendToJavaScript(val) {
            destlayer = "#" + val;
            //alert(destlayer);
            $(destlayer).addClass('over');
            $('.destinationDetailsnull').css({ 'display': 'none' });
            $(destlayer).css({ 'display': 'block', 'position': 'relative', 'right': '0px', 'top': '0px', 'z-index': '999' });
        }
        function sendToJavaScriptOnRollOut(val) {
            destlayerout = "#" + val;
            //alert(destlayer);
            $(destlayerout).removeClass('over');
            $('.destinationDetailsnull').css({ 'display': 'block' });
            $(destlayerout).css({ 'display': 'none', 'position': 'relative', 'right': '0px', 'top': '0px', 'z-index': '0' });

        }

        $('a[rel*=facebox]').facebox()

        $(".mouseOutClass").mouseover (function () 
                                            {
                                                $(this).css("display","block");
                                            }
                                       );

         $(".mouseOutClass").mouseout (function () 
                                            {
                                                $(this).css("display","none");
                                            }
                                       );

        $(".motoPackage").mouseover (function () 
                                        { 
                                           $(this ).attr('id')
                                           var abc = "#" + $(this).attr('id') + "Div"
                                           var vpos=$(this).position()
                                           //alert(abc)
                                           //alert(vpos.left + "," + vpos.top);
                                           //$(abc).css({ "display": "block"})
                                           //$(abc).css({ display: block, position: relative, left: 200, top: 200, z-index: 99 })
                                          $(abc).css("display","block")
                                          $(abc).css("position","absolute")
                                          $(abc).css("left", vpos.left - 120 + "px")
                                          $(abc).css("top", vpos.top + 32 + "px");
                                          $(abc).css("z-index", "9999");
                                        }
                                     );

                                     $(".motoPackage").mouseout (function () 
                                        { 
                                           $(this ).attr('id')
                                           var abc = "#" + $(this).attr('id') + "Div"
                                           var vpos=$(this).position()
                                           //alert(abc)
                                           //alert(vpos.left + "," + vpos.top);
                                           $(abc).css({ "display": "none"});
                                           //$(abc).css({ 'display': 'block', 'position': 'absolute', 'left': "'" + vpos.left + "'", 'top': "'" + vpos.top + "'", 'z-index': '99' })
//                                          $(abc).css({"display":"block"})
//                                          $(abc).css({"left": "100"})
//                                          $(abc).css({"right": "100"});
                                        }
                                     );
});  


// function to relocate the menu strap
function relocateStrap() {

    var curWidth = $(window).width();
    var margin = curWidth - 1000;
    margin = (margin / 2) + 210;
    var xShift = 799 - margin;

    if (parseInt(xShift) > 572) {
        // Set a minimum limit.
        xShift = 572;
    }
    xShift = "-" + xShift + 'px';

    // relocate Background
    $('#leatherWrap_menu').css('background-position', xShift);

    if (parseInt(margin) < 227) {
        margin = 227;
    }

    // relocate Menu & Content Bar
    $("#bodyContentWrapper").css('left', margin - 350);
    /*  $('#menuStrap').css('left', margin - 345);
    $('#Content').css('left', margin);  */ 
}


function activateHomepageCarousel() {

    //Show the paging and activate its first link
    //$(".paging").show();
    $(".paging a:first").addClass("active");

    //Get size of the image, how many images there are, then determin the size of the image reel.
    var imageWidth = $(".window").width();
    var imageSum = $(".image_reel img").size();
    var imageReelWidth = imageWidth * imageSum;

    //Adjust the image reel to its new size
    $(".image_reel").css({ 'width': imageReelWidth });

    //Paging  and Slider Function
    rotate = function () {
        var triggerID = $active.attr("rel") - 1; //Get number of times to slide
        var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

        $(".paging a").removeClass('active'); //Remove all active class
        $active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)

        //Slider Animation
        $(".image_reel").animate({
            left: -image_reelPosition
        }, 500);

    };

    //Rotation  and Timing Event
    rotateSwitch = function () {
        play = setInterval(function () { //Set timer - this will repeat itself every 7 seconds
            $active = $('.paging a.active').next(); //Move to the next paging
            if ($active.length === 0) { //If paging reaches the end...
                $active = $('.paging a:first'); //go back to first
            }
            rotate(); //Trigger the paging and slider function
        }, 5000); //Timer speed in milliseconds (7 seconds)
    };

    rotateSwitch(); //Run function on launch

}

function repositionPackage() {
    $("#package").css('top', '-100px');
    $("#package").css('left', '-40px');
}

// change background on radio button click 
function changeBGonRadiobtn() { }

// Will open a small window for PDF download
function openForm() {
}

// slider form for call back form
function callBackForm() { }

// change background on radio button click 
function changeRadiobtn() { 
  }
function changeRadiobtn2() {
  }
function changeRadiobtn3() { 
 
}



function onMouseOverNepal()
 	{
		
	}
	
 function onMouseOverRJ()
 	{
		
	}
	
 function onMouseOverUttra()
 	{
		
	}
	
 function onMouseOverChina()
 	{
		
	}
	
 function onMouseOverKerla()
 	{
		
	}
	
 function onMouseOverBhutan()
 	{
		
	}	

