// IMAGE PRE-LOAD //
if (document.images) {
	preloadImage			= new Image();
	preloadImage.src 		= '/assets/images/menu.hover.png';
	preloadImage			= new Image();
	preloadImage.src 		= '/assets/images/menu.select.png';
}

// IMAGE HOVER //
function flipLink(iObj, mode) {
	getSrc = String(iObj.src).split('/');
	getSrc = String(getSrc[getSrc.length - 1]).split('.');
	if (iObj.name != 'fixed') {
		iObj.src = '/assets/images/' +getSrc[0]+ '.' +getSrc[1]+ '.' +mode+ '.' +getSrc[3];
	}
}

function checkNewsInput(iObj, state) {
	if (state == 'focus') {
		if (iObj.value == 'E-Posta adresinizi giriniz...') { iObj.value = ''; iObj.style.color = '#000000'; }
	} else if (state == 'blur') {
		if (iObj.value == '') { iObj.value = 'E-Posta adresinizi giriniz...'; iObj.style.color = '#AAAAAA'; }
	}
}

// MENU SYS
var activeMenu = null;
var closingSub = null;
var waitingClose = null;

document.onclick = menuOff;

function showMenu(parent, menu, x, y) {
	menuSource = document.getElementById(parent);
	activeMenu = document.getElementById(menu);
	
	menuSource.style.backgroundImage = 'url(/assets/images/menu.select.png)';
	activeMenu.style.display = "block";
	activeMenu.style.left = parseInt(x + menuSource.offsetLeft)+ "px";
	activeMenu.style.top = parseInt(y + menuSource.offsetHeight)+ "px";
	
}

function menuExtend(menuSource)		{ clearTimeout(waitingClose); closingSub = 0; }
function menuOffWait(menuSource)	{ closingSub = activeMenu; waitingClose = setTimeout('menuOff()', 250); }
function menuOff()			{
	if (closingSub) {
		if (closingSub == activeMenu) {
			clearTimeout(waitingClose); 
			if (menuSource.className == 'menuBarItemStatic')
				{ menuSource.style.backgroundImage = 'url(/assets/images/menu.hover.png)'; }
			else
				{ menuSource.style.backgroundImage = 'none'; }
			closingSub.style.display = 'none';
			closingSub = 0;
		}
	}
}
