Prv8 Shell
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4
System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64
User : jackjohn ( 502)
PHP Version : 5.3.17
Disable Function : NONE
Directory :  /home/jackjohn/www/shopsite-images/en-AU/javascript/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/jackjohn/www/shopsite-images/en-AU/javascript/dropdown_menu.js
var dropdown_event = 0, columns = 3, closeTimeout = 500, openTimeout = 0, hover = 1, closetimer = 0, opentimer = 0, ddmenuitem = 0, closehovtimer = 0, openhovtimer = 0, hovered = 0, dropdown_enabled = 1, expand = "+", collapse = "-", mobile = 0, from_wizard = 0;

function override_html(theme) {
	if (getIEVersionNumber() < 8) {
		browser_warning();
	}
}

function set_menu_globals(enabled, event_in, expand_in, collapse_in, closeTimeout_in, openTimeout_in, columns_in, hover_in) {
	if (enabled == -1) {
		dropdown_enabled = 0;
		from_wizard = 1;
	} else
		dropdown_enabled = enabled;
	dropdown_event = event_in;
	expand=expand_in;
	collapse=collapse_in;
	closeTimeout = closeTimeout_in;
	openTimeout = openTimeout_in;
	columns = columns_in;
	hover = hover_in;
}

//http://www.java2s.com/Code/JavaScript/Development/GetIEVersionNumber.htm
function getIEVersionNumber() {
	var ua = navigator.userAgent, MSIEOffset = ua.indexOf("MSIE ");

	if (MSIEOffset == -1) {
		return 100;
	} else {
		return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
	}
}

function browser_warning() {
	if ((get_cookie("browser_warning") != "yes") && (getIEVersionNumber() <= 6)) {
		alert("ShopSite does not support Internet Explorer version 6 or lower. While all the functionality is still available, for better user interface experience we recommend updating your browser.");
		set_cookie("browser_warning", "yes", 120);
	}
}

function memorize_menu_configuration() {
	if (mobile)
		return 1;
	var cookie = '', menus = document.querySelectorAll('ul.l2_list'), i=0;
	for(; i<menus.length; i++)
	{
		if (menus[i].style.display == 'block')
			cookie = cookie + "1";
		else
			cookie = cookie + "0";
	}

	for (; i < 100; i++) {
		cookie = cookie + "0";
	}

	set_cookie("menu_configuration", cookie, 120);
}

function recall_menu_configuration() {
	var cookie = get_cookie("menu_configuration");
	if (cookie != null) {
		var menus = document.querySelectorAll('ul.l2_list'), clickers = document.querySelectorAll('a.cl');

		var ce = 0, c;

		for (c = 0; c < cookie.length; c++) {
			if (menus[c]) {
				if (cookie.charAt(c) == 0) {
					menus[c].style.display='none';
					clickers[c].innerHTML = expand;
				} else {
					menus[c].style.display='block';
					clickers[c].innerHTML = collapse;
					ce++;
				}
			}
		}
	}
}

//Peter-Paul Koch & Alex Tingle http://blog.firetree.net/2005/07/04/javascript-find-position/
function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
		while(1)
		{
			curleft += obj.offsetLeft;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

function adjust_one_drop (i, firstOffset) {
	var icon = document.getElementById("nav_icon_m" + i);
	{
		var holder = document.getElementById("mh" + i), margin = -holder.offsetWidth/2 + icon.offsetWidth/2;

		if (mobile)
			margin = 0;
		else {
			let iconX = findPosX(icon), width = $(window).width(), rbound = iconX + icon.offsetWidth/2 + holder.offsetWidth/2, lbound = iconX + icon.offsetWidth/2 - holder.offsetWidth/2;
			if (rbound > width) {
				margin += ((width-rbound) - 1);
			}

			if (lbound < 0) {
				margin -= (lbound - 1);
			}
		}
		holder.style.marginLeft = margin + "px";
		return 1;
	}
}

function adjust_locations() {
	var holder, i;
	holder = document.getElementById("mh1");

	if (holder)
	{
		var firstOffset = document.getElementById("nav_icon_m1").offsetLeft;
		for (i = 1; i <= 10; i++) {
			adjust_one_drop (i,firstOffset);
		}
	}
}

function twiddle(id, clicker_id)
{
	var listitem = document.getElementById(id), clicker = document.getElementById(clicker_id);

	if (listitem.style.display == 'block') {

		listitem.style.display = 'none';
		clicker.innerHTML = expand;
	} else {

		listitem.style.display = 'block';
		clicker.innerHTML = collapse;
	}
}

// open hidden layer
function mopen(id)
{
	// cancel close timer
	mcancelclosetime();
	mcancelopentime();

	opentimer = window.setTimeout("mopen_inn('"+id+"')",openTimeout);
}

function mopen_inn(id) {
	if(ddmenuitem)  {
		ddmenuitem.style.visibility = 'hidden';
		//ddmenuitem.style.display = 'none';

		if (mobile)
			$(ddmenuitem).find('.menu_holder').css({'display':'none'});
	}

	if ((dropdown_event == 0) || ((dropdown_event == 1) && ddmenuitem != document.getElementById(id)))
	{

		ddmenuitem = document.getElementById(id);
		ddmenuitem.style.visibility = 'visible';
		//alert(ddmenuitem.style.visibility);
		//ddmenuitem.style.display = 'block';
		if (mobile)
			$(ddmenuitem).find('.menu_holder').css({'display':'block'});
	} else if (dropdown_event == 1) {
		ddmenuitem = "";
	}
}

function mhover(id)
{
	if (hover) {
		mcancelhovclosetime();
		mcancelhovopentime();
	}
}

// close showed layer
function mclose()
{
	if(ddmenuitem) {
		ddmenuitem.style.visibility = 'hidden';
		if (mobile)
			$(ddmenuitem).find('.menu_holder').css({'display':'none'});
		//ddmenuitem.style.display = 'none';
	}
}

function mcloseout(event) {
	if (!event)
		event = window.event;
	var target = event.target;
	if (!target)
		target = event.srcElement;

	if (!target) {
		mclose();
		ddmenuitem = "";
	} else {
		if (target.src)
			var str = new String(target.src);
		else
			var str = new String(target);
	}

	if (!str || (str.search("http://") == -1 && str.search("https://") == -1)) {
		mclose();
		ddmenuitem = "";
	}
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, closeTimeout);
}

// cancel close timer
function mcancelclosetime()
{
	mcancelhovclosetime();
	mcancelopentime();
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// cancel open timer
function mcancelopentime()
{
	if(opentimer)
	{
		window.clearTimeout(opentimer);
		opentimer = null;
	}
}

function mcancelhovclosetime() {
	mcancelhovopentime();
	if(closehovtimer)
	{
		window.clearTimeout(closehovtimer);
		closehovtimer = null;
	}
}

function mcancelhovopentime()
{
	if(openhovtimer)
	{
		window.clearTimeout(openhovtimer);
		openhovtimer = null;
	}
}

// close layer when click-out
document.onclick = mcloseout;

$(window).on('resize',function() {
	if(this.resizeTO) clearTimeout(this.resizeTO);
	this.resizeTO = setTimeout(function() {
		$(this).trigger('resizeEnd');
	}, 500);
});

$(window).on('resizeEnd', function() {
	adjust_for_mobile(0);
	adjust_locations();
});

function postprocess_menu() {
	adjust_for_mobile(1);
	recall_menu_configuration();
	adjust_locations();
}

$(window).on('unload',function() {
	if (!mobile && dropdown_enabled)
		memorize_menu_configuration();
});

function configure_dropdown_menu(mobile) {
	$('.nav_icon').off('click');
	$('.nav_icon').off('mouseover');
	$('.nav_icon').off('mouseout');
	$('.drop').off('mouseover');
	$('.drop').off('mouseout');

	if (dropdown_enabled /*&& !mobile*/) {
		if (dropdown_event == 1 || mobile) {
			$('.nav_icon').on('mouseover',function() {mhover($(this).attr('id').substr(9));});
			$('.nav_icon').click(function(event) {
				if ($(this).next().find('.menu_vblock').length) {
					event.preventDefault();
					mopen($(this).attr('id').substr(9));
				}
			});
			$('.nav_icon').on('mouseout',function() {
				//munhover();
			});
		} else if (dropdown_event == 0) {
			$('.nav_icon').on('mouseover',function() {
				var m = $(this).attr('id').substr(9);
				mopen(m);
				mhover(m);
			});
			$('.nav_icon').on('mouseout',function() {
				mclosetime();
				//munhover();
			});
			$('.drop').on('mouseover',function() {
				mcancelclosetime();
			});
			$('.drop').on('mouseout',function() {
				mclosetime();
			});
		}
	}

	if (from_wizard) {
		$('.nav_icon').click(function(event) {event.preventDefault();});
	}
}

function adjust_for_mobile(init) {
	var width = $(window).width(), need_link = false;

	if (width > 750 && (mobile || init)) {
		configure_dropdown_menu(0);
		//$('#nav_icons').css({'display':'block'});
		$('#nav_bar').removeAttr('style');
		$('#nav_menu').removeAttr('style');
		$('.menu_holder').css({'display':'block'});
		$('.content, .content_wide, #footer').css({'display':'block'});
		mobile = 0;
	}
	else if (width <= 750 && (!mobile || init)) {
		$('#nav_bar').css({'display':'none'});
		$('.menu_holder').css({'display':'none'});
		mobile = 1;
		configure_dropdown_menu(1);
	}
}

$(document).on('click', '#nav_expand', function() {
	$('#nav_menu').css({'position':'absolute', 'min-height': '100%'});
	$('#nav_bar').css({'display':'block'});
	$('.content, .content_wide, #footer').css({'display':'none'});
});

$(document).on('click', '#nav_contract', function() {
	$('#nav_menu').css({'position':'static', 'min-height': '0px'});
	$('#nav_bar').css({'display':'none'});
	$('.content, .content_wide, #footer').css({'display':'block'});
});

haha - 2025