$(document).ready(function(){

	var script_name = document.location.href;
	//alert(script_name);
	if( $('#sub-menu') ){
		$('.accordion .branch li').each( function(){
			var href = $(this).find('a').attr('href');
			// alert(href);
			if( script_name.indexOf(href) > 0 ){
				$(this).parents('.branch').show();
				$(this).parents('.leaves').show();
				$(this).addClass('submenu_current');
				
			}
		});
	}


    /*
     * Product Page Sub menu
     *
     */

    if ($(".accordion .head").length) {     
        $(".accordion .head").click(function() {
            $(this).next().slideToggle("fast");

        });
        $(".accordion .subhead").click(function() {
            $(this).next().slideToggle("fast");
        });
      
        $(".accordion .subhead").mouseover(function() {        
            $(this).css('color','#993333');
        });

        $(".accordion .subhead").mouseout(function() {         
            $(this).css('color','#333333');
        });


        $(".accordion .submenu_current").parent().slideDown();     
        $(".accordion .submenu_current").parent().siblings(".subhead").css('color','#993333').unbind('mouseout');      
    }

   
    /*
     * Eye Rollover
     *
     */

    if ($(".eye a").length) {   
        var offsetX = 20;
        var offsetY = 80;
   
        $('.eye a').hover(function(e) {
            var href = $(this).attr('rel');
      
            $("body").append('<p id="screenshot"><img src="' + href + '" alt="Preview ExamVision"  /></p>');
            $("#screenshot")               
                .css('top', e.pageY - offsetY)
                .css('left', e.pageX + offsetX)
                .fadeIn("slow");
      
        }, function() {
            $('#screenshot').remove();
        });
   
        $('.eye a').mousemove(function(e) {
            $("#screenshot").css('top', e.pageY - offsetY).css('left', e.pageX + offsetX);
        });


        $('.eye a').click(function() { 
            return false;
        });

    }


     $('#flip-up-working').cycle();
	 
	   $('#overview_slide2').cycle({timeout:5000});
	 $('#overview_slide').cycle({timeout:7000});
	 
	 $("#rolloving img").hover(function() {
    $(this).attr("src", $(this).attr("src").replace(".jpg","_ro.jpg"));
  }, function() {
    $(this).attr("src", $(this).attr("src").replace("_ro.jpg",".jpg"));
  });

});
