//font size
function validate()
{
	if(!chkBlank(frm.mID,"¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä.")) {return false;}
	if(!chkBlank(frm.mPwd,"ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä.")) {return false;}
	return true;
}

defsize = 9;
function zoom_it(n) {
  defsize+=n;
  objs = document.getElementsByTagName("body");
  for(i=0;i<objs.length;i++)
    objs[i].style.fontSize=defsize + "pt";
}


//flash
function  viewFlash(sURL, sName, sFeatures){

 //ÇÃ·¡½Ã ActiveX ¿ÀºêÁ§Æ®¸¦ »Ñ·ÁÁÝ´Ï´Ù.
 var FLASHCAB = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab";
 var FLASHCID = "CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000";
 var FLASHVER = "8,0,0,0";

 var sFeature;
 var sWidth  = "100%";
 var sHeight  = "100%";
 var pmBoolean = "false";
 var sTempArray;
 var sParamTag = "";

 sFeature = sFeatures.split(/\s*,\s*/);
 for (var i=0; i< sFeature.length ; i++)
 {
  sTempArray = sFeature[i].split(/\s*=\s*/);
  if (sTempArray[0].toLowerCase() == "width"){
   //³ÐÀÌ
   sWidth = sTempArray[1];
  }else if (sTempArray[0].toLowerCase() == "height"){
   //³ôÀÌ
   sHeight = sTempArray[1];
  }else{
   //±âÅ¸ ÆÄ¶ó¸ÞÅÍ Ã³¸®
   if (sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true"){
    pmBoolean = "true";
   }else if (sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false"){
    pmBoolean = "false";
   }else{
    pmBoolean = sTempArray[1]; 
   }
   sParamTag = "<PARAM NAME='"+sTempArray[0]+"'VALUE='" + pmBoolean + "'>\n"+sParamTag;
  }
 }

 document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+FLASHCID+"' CODEBASE='"+FLASHCAB+"#version="+FLASHVER+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"'>");
 document.write("<PARAM NAME='movie' VALUE='" + sURL + "'>");
 document.write("<PARAM NAME='wmode' VALUE='transparent'>"); 
 document.write(sParamTag);
 document.write("<EMBED SRC='"+sURL+"' MENU='false' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' ID='"+sName+"' NAME='"+sName+"' wmode='transparent' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' />")
 document.write("</OBJECT>");
}

//quick-link
function getPosition(){
	var start, end, scale, term;
	start = parseInt (document.getElementById('quick-link').style.top, 10);
	end = document.documentElement.scrollTop + 200;
	term = 5;

	if ( start != end ) {
	scale = Math.ceil( Math.abs( end - start ) / 20 );
		if ( end < start )	scale = -scale;
		document.getElementById('quick-link').style.top = parseInt (document.getElementById('quick-link').style.top, 10)+ scale + "px";
		term = 1;
	}
	setTimeout ("getPosition()", term);
}
function moveBanner() {
	document.getElementById('quick-link').style.top = document.documentElement.scrollTop + 500 + "px";
	getPosition();
	return true;
}

/**

 * GW ASSET µðÀÚÀÎ ½ºÅ©¸³Æ®

 */



/**

 * °øÅë ½ºÅ©¸³Æ® (»çÀÌÆ® Àü¹ÝÀûÀ¸·Î »ç¿ëµÇ´Â ½ºÅ©¸³Æ®)

 */



// image roll

function menuOver() {

	this.src = this.src.replace(".gif", "_on.gif");

}

function menuOut() {

	this.src = this.src.replace("_on.gif", ".gif");

}



function imageOver(imgEl) {

	imgEl.src = imgEl.src.replace(".gif", "_on.gif");

}

function imageOut(imgEl) {

	imgEl.src = imgEl.src.replace("_on.gif", ".gif");

}



// element toggle

function blockToggle(href) {

	targetElement = document.getElementById(href.split("#")[1]);



	if (targetElement && targetElement.style.display == "block") {

		targetElement.style.display = "none";

	} else {

		targetElement.style.display = "block";

	}

	return false;

}





// tabbed menu
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		thismenu = tabAnchor.item(i);

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

function tabMenuClick() {

	currentmenu = this.menuContainer.current;

	if (currentmenu != this) {

		currentmenu.targetEl.style.display = "none";

		currentmenu.getElementsByTagName("img").item(0).onmouseover = menuOver;

		currentmenu.getElementsByTagName("img").item(0).onmouseout = menuOut;

		currentmenu.getElementsByTagName("img").item(0).onmouseout();



		this.targetEl.style.display = "block";

		this.getElementsByTagName("img").item(0).onmouseover = null;

		this.getElementsByTagName("img").item(0).onmouseout = null;

		this.menuContainer.current = this;

	}

	return false;
}





//¸Þ´º
var currentMenu;	// current shown menu (mouse over)
var focusMenu;	// current page menu
var menu = new Array();	// each menu array

function menuOver() {
	this.src = this.src.replace(".gif", "_on.gif");
}

function menuOut() {
	this.src = this.src.replace("_on.gif", ".gif");
}

function initFocus() {		// current page menu focusing
	if (focusMenu) {
		currentMenu = focusMenu;
	} else {
		currentMenu = null;
	}
	showSubmenu();
}

function showSubmenu() {
	if (currentMenu) {
		if(currentMenu.submenu != undefined){
			currentMenu.submenu.style.display = "block";
		}
		currentMenu.isMenuOver = true;
	}
}

function hideSubmenu() {
	if (currentMenu && !currentMenu.isMenuOver) {
		if(currentMenu.submenu != undefined){
			currentMenu.submenu.style.display = "none";
		}

		currentMenu.isMenuOver = false;
		initFocus();
	}
}

function navigationOver() {		// onmouseover
	hideSubmenu();
	if (focusMenu && focusMenu.submenu != undefined) {
		focusMenu.submenu.style.display = "none";
	}

	currentMenu = this;
	showSubmenu();
}

function navigationOut() {		// onmouseout
	this.isMenuOver = false;
	setTimeout("hideSubmenu()", 500);
}

function subOver() {
	this.menu.isMenuOver = true;
}

function initNavigation(seq) {
	for(i=1; i<7; i++) {
		menu[i] = document.getElementsBySelector("#top-navigation li.menu-" + i)[0];
		menu[i].onmouseover = navigationOver;
		menu[i].onmouseout = navigationOut;
 		menu[i].submenu = document.getElementsBySelector("#top-navigation li.menu-" + i +" ul.depth2")[0];
		if(menu[i].submenu != undefined){
			menu[i].submenu.menu = menu[i];
			menu[i].submenu.onmouseover = subOver;
		}
	}
}

// convert menu text to image
function initTopNavigation() {
	topMenuEl = document.getElementById("top-navigation").getElementsByTagName("li");

	for (i=0; i<topMenuEl.length; i++) {
		var menuAnchor = topMenuEl[i].getElementsByTagName("a")[0];
		menuAnchor.innerHTML = "<img src=\"../images/inc/" + topMenuEl[i].className + ".gif\" alt=\"" + menuAnchor.innerHTML + "\" />";
		menuAnchor.getElementsByTagName("img").item(0).onmouseover = menuOver;
		menuAnchor.getElementsByTagName("img").item(0).onmouseout = menuOut;
	}

	// remove slashed background image of first menu item
	topMenuD2El = document.getElementsBySelector("#top-navigation ul.depth2");
	for (i=0; i<topMenuD2El.length; i++) {
		topMenuD2El[i].getElementsByTagName("li").item(0).style.background = "none";
	}
}


function initLocation() {

	initNavigation();

	if (document.getElementById("locator")) {
		loc = document.getElementById("locator").getElementsByTagName("a");

		if (document.getElementById("top-navigation") && document.getElementById("top-navigation").getElementsByTagName("li")) {
			topMenuLi = document.getElementById("top-navigation").getElementsByTagName("li");

			for(j=0; j<topMenuLi.length; j++) {
				topMenuText = topMenuLi[j].getElementsByTagName("img").item(0).alt;
				if (loc.item(1) && topMenuText == loc.item(1).innerHTML) {		// top menu depth1
					focusMenu = menu[topMenuLi[j].className.substr(topMenuLi[j].className.length-1, 1)];
				
					initFocus();
					if (currentMenu.getElementsByTagName("img").item(0).src.indexOf("_on.gif") == -1) {
						currentMenu.getElementsByTagName("img").item(0).onmouseover();
					}

					currentMenu.getElementsByTagName("img").item(0).onmouseover = null;
					currentMenu.getElementsByTagName("img").item(0).onmouseout = null;
				}

				if (loc.item(2) && topMenuText == loc.item(2).innerHTML) {		// top menu depth2
					topMenuLi[j].getElementsByTagName("img").item(0).onmouseover();
					topMenuLi[j].getElementsByTagName("img").item(0).onmouseover = null;
					topMenuLi[j].getElementsByTagName("img").item(0).onmouseout = null;
				}
			}
		}

		if (document.getElementById("sub-navigation") && document.getElementById("sub-navigation").getElementsByTagName("li")) {
			subMenuLi = document.getElementById("sub-navigation").getElementsByTagName("li");
			for(i=0; i<subMenuLi.length; i++) {
				subMenuText = subMenuLi[i].getElementsByTagName("img").item(0).alt;
				if (loc.item(2) && subMenuText == loc.item(2).innerHTML) {		// sub menu depth2
					if (subMenuLi[i].getElementsByTagName("img").item(0).src.indexOf("_on.gif") == -1) {
						subMenuLi[i].getElementsByTagName("img").item(0).onmouseover();
					}
					subMenuLi[i].getElementsByTagName("img").item(0).onmouseover = null;
					subMenuLi[i].getElementsByTagName("img").item(0).onmouseout = null;
					if (subMenuLi[i].getElementsByTagName("ul").item(0)) {
						subMenuLi[i].getElementsByTagName("ul").item(0).style.display = "block";
					}
				}
				if (loc.item(3) && subMenuText == loc.item(3).innerHTML) {		// sub menu depth3
					if (subMenuLi[i].getElementsByTagName("img").item(0).src.indexOf("_on.gif") == -1) {
						subMenuLi[i].getElementsByTagName("img").item(0).onmouseover();
					}
					subMenuLi[i].getElementsByTagName("img").item(0).onmouseover = null;
					subMenuLi[i].getElementsByTagName("img").item(0).onmouseout = null;
				}
			}
		}
	}
}

function initSubNavigation() {
	subMenuEl = document.getElementById("sub-navigation").getElementsByTagName("li");
	for (i=0; i<subMenuEl.length; i++) {
		var menuAnchor = subMenuEl[i].getElementsByTagName("a")[0];
		menuAnchor.innerHTML = "<img src=\"../images/" + subMenuEl[i].className + ".gif\" alt=\"" + menuAnchor.innerHTML + "\" />";
		menuAnchor.getElementsByTagName("img").item(0).onmouseover = menuOver;
		menuAnchor.getElementsByTagName("img").item(0).onmouseout = menuOut;
	}

}

document.getElementsBySelector = function(selector) {
	// Attempt to fail gracefully in lesser browsers

	if (!document.getElementsByTagName) {
		return new Array();
	}

	// Split selector in to tokens
	var tokens = selector.split(' ');
	var currentContext = new Array(document);

	for (var i = 0; i < tokens.length; i++) {
		token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
		if (token.indexOf('#') > -1) {
			// Token is an ID selector
			var bits = token.split('#');
			var tagName = bits[0];
			var id = bits[1];
			var element = document.getElementById(id);

			if (tagName && element.nodeName.toLowerCase() != tagName) {
				// tag with that ID not found, return false
				return new Array();
			}

			// Set currentContext to contain just this element
			currentContext = new Array(element);
			continue; // Skip to next token
		}

		if (token.indexOf('.') > -1) {
			// Token contains a class selector
			var bits = token.split('.');
			var tagName = bits[0];
			var className = bits[1];

			if (!tagName) {
				tagName = '*';
			}

			// Get elements matching tag, filter them for class selector
			var found = new Array;
			var foundCount = 0;
			for (var h = 0; h < currentContext.length; h++) {
				var elements;
				if (tagName == '*') {
						elements = getAllChildren(currentContext[h]);
				} else {
						elements = currentContext[h].getElementsByTagName(tagName);
				}

				for (var j = 0; j < elements.length; j++) {
					found[foundCount++] = elements[j];
				}
			}

			currentContext = new Array;
			var currentContextIndex = 0;
			for (var k = 0; k < found.length; k++) {
				if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
					currentContext[currentContextIndex++] = found[k];
				}
			}

			continue; // Skip to next token
		}

		// Code to deal with attribute selectors

		if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
			var tagName = RegExp.$1;
			var attrName = RegExp.$2;
			var attrOperator = RegExp.$3;
			var attrValue = RegExp.$4;
			if (!tagName) {
				tagName = '*';
			}
			// Grab all of the tagName elements within current context
			var found = new Array;
			var foundCount = 0;
			for (var h = 0; h < currentContext.length; h++) {
				var elements;
				if (tagName == '*') {
						elements = getAllChildren(currentContext[h]);
				} else {
						elements = currentContext[h].getElementsByTagName(tagName);
				}

				for (var j = 0; j < elements.length; j++) {
					found[foundCount++] = elements[j];
				}
			}

			currentContext = new Array;
			var currentContextIndex = 0;
			var checkFunction; // This function will be used to filter the elements
			switch (attrOperator) {
				case '=': // Equality
					checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
					break;
				case '~': // Match one of space seperated words
					checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
					break;
				case '|': // Match start with value followed by optional hyphen
					checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
					break;
				case '^': // Match starts with value
					checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
					break;
				case '$': // Match ends with value - fails with "Warning" in Opera 7
					checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
					break;
				case '*': // Match ends with value
					checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
					break;
				default :
				// Just test for existence of attribute
				checkFunction = function(e) { return e.getAttribute(attrName); };
			}

			currentContext = new Array;
			var currentContextIndex = 0;
			for (var k = 0; k < found.length; k++) {
				if (checkFunction(found[k])) {
					currentContext[currentContextIndex++] = found[k];
				}
			}

			continue; // Skip to next token
		}

		// If we get here, token is JUST an element (not a class or ID selector)

		tagName = token;
		var found = new Array;
		var foundCount = 0;
		for (var h = 0; h < currentContext.length; h++) {
			var elements = currentContext[h].getElementsByTagName(tagName);
			for (var j = 0; j < elements.length; j++) {
				found[foundCount++] = elements[j];
			}
		}

		currentContext = found;
	}

	return currentContext;
}

function openWindow(go){
	window.open(go,"_blank")
}

function email_self(selectbar){

	for(i=0;i<selectbar.options.length;i++){
		if(selectbar.options[i].selected&&selectbar.options[i].value=="self"){
			document.getElementById("self_input_email").style.display="inline";
			document.getElementById("self_input_email").focus();
		}
		else{
			document.getElementById("self_input_email").style.display="none";	
		}
	}
}



function openMenu(gb) {

	document.getElementById("btn_Menu").innerHTML = "<a href=\"#\" onclick=\"closeMenu(); return false;\" onkeypress=\"\";><img src=\"images/main/btn_close.gif\" alt=\"close\" /></a>";
	for(i=1;i<=3;i++){
		if(i == gb){
			document.getElementById("toolbarBot"+i).style.display = 'block';
		}else{
			document.getElementById("toolbarBot"+i).style.display = 'none';
		}
	}

} 

function closeMenu() {
	document.getElementById("btn_Menu").innerHTML = "<a href=\"#\" onclick=\"openMenu(1); return false;\" onkeypress=\"\";><img src=\"images/main/btn_open.gif\" alt=\"open\" /></a>";
	for(i=1;i<=3;i++){
		document.getElementById("toolbarBot"+i).style.display = 'none';
	}

} 



function popitup(url) {
	newwindow=window.open('http://www.kenzoramen.ca/kenzo_location.php','location','height=480,width=640');

	if (window.focus) {newwindow.focus()}

	return false;

}

function popup_contact(url) {

	newwindow=window.open('http://www.kenzoramen.ca/contact.php','location','height=480,width=640');


	if (window.focus) {newwindow.focus()}

	return false;

}
