/*--------------------------------------------------------------
*Filename:			custom.js
*Description:		Customised javascript file
*Version:			1.0.0(2010.02.26)
*Website:			Calsoft
*Author:			Ohmkumar.J
--------------------------------------------------------------*/
/* ---------------- Bookmark ------------------ */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
/* ---------------- Bookmark ------------------ */
$(document).ready(function() 
	{
		var config = {    
						sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)
						interval: 150, // number = milliseconds for onMouseOver polling interval
						over: openDropdown, // function = onMouseOver callback (REQUIRED)
						timeout: 150, // number = milliseconds delay before onMouseOut
						out: closeDropdown // function = onMouseOut callback (REQUIRED)
					};
					
		function openDropdown()
		{									
			//$(this).addClass('over')
			$(this).children("div.home_menu_sub, div.home_popular_sub, div.home_new_sub, div.home_hot_sub, div.home_career_sub, div.home_contact_sub").toggle();
		}
		
		function closeDropdown()
		{
			//$(this).removeClass('over')
			$(this).children("div.home_menu_sub, div.home_popular_sub, div.home_new_sub, div.home_hot_sub, div.home_career_sub, div.home_contact_sub").toggle();
		}
		
			//  menu items id seperated by comma
		$("#home_down, #home_popular, #home_new, #home_hot, #home_career, #home_contact").hoverIntent( config );
		
		applyDefaultValue($('#home_search'), 'Search');
		
		function applyDefaultValue(elem, val) {
		  elem.value = val;
		  elem.onfocus = function() {
			if(this.value == val) {
			  this.style.color = '';
			  this.value = '';
			}
		  }
		  elem.onblur = function() {
			if(this.value == '') {
			  this.value = val;
			}
		  }
		}
		
							
	});	




(function ($) {
        $.fn.fadeTransition = function(options) {
          var options = $.extend({pauseTime: 5000, transitionTime: 2000}, options);
          var transitionObject;

          Trans = function(obj) {
            var timer = null;
            var current = 0;
            var els = $("> *", obj).css("display", "none").css("left", "0").css("top", "0").css("position", "absolute");
            $(obj).css("position", "relative");
            $(els[current]).css("display", "block");

            function transition(next) {
              $(els[current]).fadeOut(options.transitionTime);
              $(els[next]).fadeIn(options.transitionTime);
              current = next;
              cue();
            };

            function cue() {
              if ($("> *", obj).length < 2) return false;
              if (timer) clearTimeout(timer);
              timer = setTimeout(function() { transition((current + 1) % els.length | 0)} , options.pauseTime);
            };
            
            this.showItem = function(item) {
              if (timer) clearTimeout(timer);
              transition(item);
            };

            cue();
          }

          this.showItem = function(item) {
            transitionObject.showItem(item);
          };

          return this.each(function() {
            transitionObject = new Trans(this);
          });
        }

      })(jQuery);
    
      var page = {
        tr: null,
        init: function() {
          page.tr = $(".area").fadeTransition({pauseTime: 7000, transitionTime: 2000});
          $("div.navigation").each(function() {
            $(this).children().each( function(idx) {
              if ($(this).is("a"))
                $(this).click(function() { page.tr.showItem(idx); })
            });
          });
        },

        show: function(idx) {
          if (page.tr.timer) clearTimeout(page.tr.timer);
          page.tr.showItem(idx);
        }
      };

      $(document).ready(page.init); 
	  $(document).ready(function()
	  {
			//$(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:"facebook"});
	  });	
$(document).ready(function(){
/* ----------- Footer Control --------------------- */
	$(".send_open").click(function () {
	$(".send_friend").show("slow");
});
	$(".friend_close").click(function () {
	$(".send_friend").hide("slow");
});
});	




