
jQuery(document).ready(function(){

	// drop down menu
	jQuery('#nav').menuDropdown({
		style           :   'above',   // set menu style: 'dropDown' or 'above'
		effect          :   'fade',   // set how dropdown menu will show: 'fade', 'slideToggle' or 'show'
		showSpeed       :   850,   // how fast will dropdown show
		hideSpeed       :   850,   // how fast will dropdow hide
		opacity         :   1   // sub-menu opacity
	});
});


/* ----------------------------------------------------------------------------------------------------------------*/
/* ROLLOVERS IMAGE _ON _OFF */
/* ----------------------------------------------------------------------------------------------------------------*/
function paCreateRollOvers(){
	if(document.getElementById){
		var paImages = document.getElementsByTagName('IMG');
		var paButtons = document.getElementsByTagName('INPUT');
	}else if(document.all && navigator.userAgent.indexOf('Mac')==-1){
		var paImages = document.all['mouseovers'].all.tags('IMG');
		var paButtons = document.all['mouseovers'].all.tags('INPUT');
	}else return;
	paPreloads = new Object();

	for (var i = 0; i < paImages.length; i++){
		var paImageOffSrc = paImages[i].src + "";
		if(paImageOffSrc.indexOf("_off.") != -1){
			var paImageOnSrc = paImageOffSrc.replace(/_off\./g, "_on.");
			paPreloads['paImageOff_' + i] = new Image();
			paPreloads['paImageOff_' + i].src = paImageOffSrc;
			paPreloads['paImageOn_' + i] = new Image();
			paPreloads['paImageOn_' + i].src = paImageOnSrc;
			/*paPreloads['paImageOn_' + i].onerror = function(){this.src='/images/blank.gif';}*/
			paImages[i].onmouseover = function(){this.src = this.src.replace(/_off\./g, "_on.");}
			paImages[i].onmouseout = function(){this.src = this.src.replace(/_on\./g, "_off.");}
		}
	}

	for (var i = 0; i < paButtons.length; i++){
		if(paButtons[i].src){
		var paImageOffSrc = paButtons[i].src + "";
		if(paImageOffSrc.indexOf("_off.") != -1){
			var paImageOnSrc = paImageOffSrc.replace(/_off\./g, "_on.");
			paPreloads['paImageOff_' + i] = new Image();
			paPreloads['paImageOff_' + i].src = paImageOffSrc;
			paPreloads['paImageOn_' + i] = new Image();
			paPreloads['paImageOn_' + i].src = paImageOnSrc;
			/*paPreloads['paImageOn_' + i].onerror = function(){this.src='/images/blank.gif';}*/
			paButtons[i].onmouseover = function(){this.src = this.src.replace(/_off\./g, "_on.");}
			paButtons[i].onmouseout = function(){this.src = this.src.replace(/_on\./g, "_off.");}
		}
		}
	}
}
window.onload = paCreateRollOvers;



/* ----------------------------------------------------------------------------------------------------------------*/
/* ADDITIONAL HIDE SHOW SCRIPTS */
/* ----------------------------------------------------------------------------------------------------------------*/
function hide(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    obj.style.display = "none";
    }
    }

function show(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    obj.style.display = "";
    }
    }

function ajaxhide1(id){
		$(id).hide("slow");
	}
function ajaxshow1(id){
		$(id).show("slow");
	}
function ajaxshow(id){
		$(id).fadeIn("slow");
	}
function ajaxhide(id){
		$(id).fadeOut("slow");
	}

function toggler(id){
		$(id).slideToggle("fast");
}
jQuery.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);

};
function toggler1(id){
		$(id).fadeToggle("fast");
}

(function($){
	$.fn.menuDropdown = function(options){

		var defaults = {
			style: 'above',
			showSpeed: 300,
			easing: '',
			hideSpeed: 150,
			effect: 'fade',
			opacity: 1
		};

		var options = $.extend(defaults, options);

		return this.each(function(){
			var menu = $(this);

			menu.find('a').removeAttr('title');
			menu.find('ul').css({ "display": "none", "opacity": options.opacity });
			if (options.style == 'above' && !($.browser.msie && $.browser.version.substr(0,1)<7)){
				menu.find('li').css({ "position": "static" });
				menu.addClass('above');
			}
			else {
				menu.addClass('drop-down');
			}
			menu.find('li').hover(
				function(){
					var target = $(this).find('ul:first');
					if(options.effect == 'fade'){
						target.css({ "visibility": "visible", "display": "block", "opacity": "0" });
					}
					else {
						target.css({ "visibility": "visible", "display": "none" });
					}
					if (options.effect == 'fade'){
						target.stop().animate({ opacity:options.opacity }, { queue:false, duration:options.showSpeed, easing:options.easing });
					}
					else if (options.effect == 'slideToggle'){
						target.slideToggle(options.showSpeed, options.easing);
					}
					else if (options.effect == 'show'){
						target.show(options.showSpeed, options.easing);
					}
				},
				function(){
					var target = $(this).find('ul:first');
					if (options.hideSpeed <= 0){
						target.css({ "visibility": "hidden" });
					}
					else if (options.effect == 'fade'){
						target.stop().animate({ opacity:"0" }, { queue:false, duration:options.hideSpeed, easing:options.easing, complete:function(){
							target.css({ "visibility": "hidden", "display":"none" });
						} });
					}
					else if (options.effect == 'slideToggle'){
						target.slideToggle(options.hideSpeed, options.easing, function(){
							target.css({ "visibility": "hidden" });
						});
					}
					else if (options.effect == 'show'){
						target.hide(options.hideSpeed, options.easing, function(){
							target.css({ "visibility": "hidden" })
						});
					}
				}
			);
		});
	}
})(jQuery);

myUrl = location.href;
mySub1 = ".php";
mySub2 = "-hebrew.php";

function leftFromSubStringToBeginningOfFullString(fullString, subString) {
if (fullString.lastIndexOf(subString) == -1) {
return "";
} else {
return fullString.substring(0, fullString.lastIndexOf(subString));
}
}

function hebrew() {
myText = leftFromSubStringToBeginningOfFullString(myUrl, mySub1);
document.write('<a href="');
document.write(myText);
document.write('-hebrew.php">');
document.write('<img src="http://transformagency.biz/clients3/clickwise/_include/images/b_hebrew.png" width="51" height="23" alt="" />');
document.write('</a>');
}

function english() {
myText = leftFromSubStringToBeginningOfFullString(myUrl, mySub2);
document.write('<a href="');
document.write(myText);
document.write('.php">');
document.write('<img src="http://transformagency.biz/clients3/clickwise/_include/images/b_english.png" width="56" height="23" alt="" />');
document.write('</a>');
}











