// JavaScript Document
function str_replace (search, replace, subject, count) {
    var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0,
            f = [].concat(search),
            r = [].concat(replace),
            s = subject,
            ra = r instanceof Array, sa = s instanceof Array;
    s = [].concat(s);
    if (count) {
        this.window[count] = 0;
    }

    for (i=0, sl=s.length; i < sl; i++) {
        if (s[i] === '') {
            continue;
        }
        for (j=0, fl=f.length; j < fl; j++) {
            temp = s[i]+'';
            repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
            s[i] = (temp).split(f[j]).join(repl);
            if (count && s[i] !== temp) {
                this.window[count] += (temp.length-s[i].length)/f[j].length;}
        }
    }
    return sa ? s : s[0];
}
jQuery.fn.extend({
	AnimateMenu:function(speed){
		var total_widths 	= 0;
		var MarginLeft		= 0;
		var MarginRight		= 0;
		if(!speed)var speed = 1000;
		jQuery(this).css({display:"block"});
		jQuery(this).children().each(function(){
			total_widths 	+= jQuery(this).outerWidth();
			MarginLeft  = parseInt(jQuery(this).css("margin-left"),10);
			MarginRight = parseInt(jQuery(this).css("margin-right"),10);
			if(!isNaN(MarginLeft))total_widths 	+= MarginLeft;	
			if(!isNaN(MarginRight))total_widths 	+= MarginRight;
			jQuery(this).css({left:"-"+(total_widths)+"px"});
		});
		jQuery(this).children().animate({left:"0px"},speed,PanelEfects);
	}						   
});
function PanelEfects(){
	jQuery(".FadeInAnimation").fadeIn(500);
	jQuery(".AnimatedDiv2").slideDown(500);
}
jQuery(document).ready(function($) {
	
	jQuery(".AnimatedMenu").AnimateMenu();
	/*Search Box text*/
	jQuery("#SearchText").focus(function(){
		if($(this).attr('value')=='Search')$(this).attr('value','');
	}).blur(function(){
		if($(this).attr('value')=='')$(this).attr('value','Search');
	});
	/*Services*/
	jQuery(".ServiceTitle").hover(function(){
		$(this).next('.ServiceText').slideDown();								   
	},function(){
		$(this).next('.ServiceText').slideUp();
	});
});


