
//----------------------------------------------------------
//    DOM HTML
//    Ver 0.9.2
//----------------------------------------------------------
//  Get elements by class name
document.getElementsByClassName = function(cl) {
	var retnode = [];
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = this.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
		if (myclass.test(classes)) {
			retnode.push(elem[i]);
		}
	}
	return retnode;
}

var DomHTML = {

	//-------------------------------------------------------
	//    Document width
	//-------------------------------------------------------
	getDocumentWidth: function (_document) {
		if (!_document) { _document = document;}
		if(_document.body) {
			if(_document.body.scrollWidth || _document.body.scrollWidth == 0) {
				return _document.body.scrollWidth;
			}
			if(_document.documentElement) {
				return _document.documentElement.offsetWidth;
			}
			return _document.body.offsetWidth;
		}
	
		if(_document.width || _document.width == 0) {
			return _document.width;
		}
		return 0;
	},


	//-------------------------------------------------------
	//    Get scroll top
	//-------------------------------------------------------
	getScrollTop: function() {
		if(window.scrollY) { return window.scrollY;}
		if(window.pageYOffset) { return window.pageYOffset;}
		if(document.documentElement && document.documentElement.scrollTop){
			return document.documentElement.scrollTop;
		} else if(document.body && document.body.scrollTop) {
			return document.body.scrollTop;
		}
		return 0;
	},


	//-------------------------------------------------------
	//    Document height
	//-------------------------------------------------------
	getDocumentHeight: function () {
		if(document.body) {
			if(document.body.scrollHeight || document.body.scrollHeight == 0) {
				return document.body.scrollHeight;
			}
			if(document.documentElement) {
				return document.documentElement.offsetHeight;
			}
			return document.body.offsetHeight;
		}	
		if(document.height || document.height == 0) {
			return document.height;
		}
		return 0;
	},


	//-------------------------------------------------------
	//    Effects
	//-------------------------------------------------------
	effects: {

		//-----------------------
		//  Set width
		//-----------------------
		width: function(_target, _width, _fade) {
			var current = _target.offsetWidth;
			if (!_fade) {
				var width = _width;
			} else {
				var width = current + ((_width - current) / _fade);
				if (width != current) {
					setTimeout(function() { DomHTML.effects.width(_target, _width, _fade / 1.25)}, 50);
				}
			}
			_target.style.width = width + "px";
		},

		//-----------------------
		//  Set opacity
		//-----------------------
		opacity: function(_target, _opacity, _fade, _fadetype) {
			var current = _target.style.opacity * 100;
			if (!_fade) {
				var opacity = _opacity;
			} else {
				var opacity = Math.round(current + ((_opacity - current) / _fade));
				if (opacity != current) {
					setTimeout(function() { DomHTML.effects.opacity(_target, _opacity, _fade / 1.25)}, 50);
				}
			}
			_target.style.zoom = 1;
			_target.style.filter = 'alpha(opacity=' + (opacity) + ')';
			_target.style.MozOpacity = opacity / 100;
			_target.style.opacity = opacity / 100;
		}
	},


	//-------------------------------------------------------
	//    Add event
	//-------------------------------------------------------
	addEvent: function(elemObj, eventType, funcName, useCapture) {
		if (!elemObj) { return false;}
		if (elemObj.addEventListener){
			elemObj.addEventListener(eventType, funcName, useCapture);
		} else if (elemObj.attachEvent){
			elemObj.attachEvent("on"+eventType, funcName);
		} else {
			return false;
		}
		return true;
	}

};

//----------------------------------------------------------
//    New window
//     Ver 1.0.0 [ 2008.3.18 ]
//     <a rel="newWindow[args...]" title="[Name]">
//     Charset=UTF-8
//----------------------------------------------------------
var NewWindow = {

	//-------------------------------------------------------
	//    Set
	//-------------------------------------------------------
	set: function() {
		var links = document.getElementsByTagName("a");
		var imax = links.length;
		for (var i=0;i<imax;i++) {
			if (!links[i].rel) { continue;}
			if (!links[i].rel.match(/newWindow/)) { continue;}
			var args = links[i].rel.replace("newWindow", "").split(" ");
			args.unshift(links[i].title);
			args.unshift(links[i].href);
			links[i].onclick = NewWindow.setOpen (args);
		}
	},


	//-------------------------------------------------------
	//    Window open
	//-------------------------------------------------------
	setOpen: function(URL) {
		var func = function() {
			NewWindow.open(URL);
			return false;
		}
		return func;
	},
	open: function(_args) {
	    var win;
		URL = _args[0];
		NAME = _args[1] || "NewWindow";
		WIDTH = _args[2] || 300;
		HEIGHT = _args[3] || 450;
		SCROLL = _args[4] || "yes";
		RESIZE = _args[5] || "yes";
		TOOLBAR = _args[6] || "no";
		LOCATION = _args[7] || "no";
		DIRECTORIES = _args[8] || "no";
		STATUS = _args[9] || "no";
		MENUBAR = _args[10] || "no";
	    win = window.open(
			URL,
			NAME,
			"toolbar=" + TOOLBAR +
			",location=" + LOCATION +
			",directories=" + DIRECTORIES +
			",status=" + STATUS +
			",menubar=" + MENUBAR +
			",scrollbars=" + SCROLL +
			",resizable=" + RESIZE +
			", width="+ WIDTH +
			", height=" + HEIGHT
		);
	    win.focus();
	},


	//-------------------------------------------------------
	//    Add event
	//-------------------------------------------------------
	addEvent: function(elemObj, eventType, funcName, useCapture) {
		if (!elemObj) { return false;}
		if (elemObj.addEventListener){
			elemObj.addEventListener(eventType, funcName, useCapture);
		} else if (elemObj.attachEvent){
			elemObj.attachEvent("on"+eventType, funcName);
		} else {
			return false;
		}
		return true;
	}
};
NewWindow.addEvent(window, "load", NewWindow.set);

//----------------------------------------------------------
//     Image window open
//     2008.05.07 ver 0.0.1
//     <img class="ImageWIndow" />
//----------------------------------------------------------
var ImageWindow = {

	//-------------------------------------------------------
	//    Set
	//-------------------------------------------------------
	set: function() {
		var images = document.getElementsByTagName("img");
		var imax = images.length;
		for (var i=0;i<imax;i++) {
			if (!images[i].className) { continue;}
			if (images[i].className != "ImageWindow") { continue;}
			images[i].onclick = ImageWindow.setOpen (images[i]);
			images[i].style.cursor = "pointer";
		}
	},


	//-------------------------------------------------------
	//    Window open
	//-------------------------------------------------------
	setOpen: function(TARGET) {
		var target = TARGET;
		var func = function() {
			var image = new Image();
			image.src = target.src;
			ImageWindow.open(image.src, "ImageWindow", image.width, image.height);
		}
		return func;
	},
	open: function(URL, NAME, WIDTH, HEIGHT, SCROLL, RESIZE, TOOLBAR, LOCATION, DIRECTORIES, STATUS, MENUBAR) {
	    var win;
		NAME = NAME || "ImageWindow";
		WIDTH = WIDTH || 640;
		HEIGHT = HEIGHT || 480;
		SCROLL = SCROLL || "no";
		RESIZE = RESIZE || "yes";
		TOOLBAR = TOOLBAR || "no";
		LOCATION = LOCATION || "no";
		DIRECTORIES = DIRECTORIES || "no";
		STATUS = STATUS || "no";
		MENUBAR = MENUBAR || "no";
		if (WIDTH > (screen.width - 100)) {
			WIDTH = screen.width - 100;
			SCROLL = "yes";
		}
		if (HEIGHT > (screen.height - 200)) {
			HEIGHT = screen.height - 200;
			SCROLL = "yes";
		}
	    win = window.open(
			"",
			NAME,
			"toolbar=" + TOOLBAR +
			",location=" + LOCATION +
			",directories=" + DIRECTORIES +
			",status=" + STATUS +
			",menubar=" + MENUBAR +
			",scrollbars=" + SCROLL +
			",resizable=" + RESIZE +
			", width="+ WIDTH +
			", height=" + HEIGHT
		);
		win.document.open();
		win.document.write("<html><head><title>ImageWindow</title><style type=\"text/css\">*{margin: 0;padding: 0;}</style></head><body><img src=\"" + URL + "\"></body></html>");
		win.document.close();
		win.resizeTo(WIDTH, HEIGHT);
		win.moveTo(30, 30);
	    win.focus();
	},

	//-------------------------------------------------------
	//    Add event
	//-------------------------------------------------------
	addEvent: function(elemObj, eventType, funcName, useCapture) {
		if (elemObj.addEventListener){
			elemObj.addEventListener(eventType, funcName, useCapture);
			return true;
		} else if (elemObj.attachEvent){
			var r = elemObj.attachEvent("on"+eventType, funcName);
			return r;
		}
		return false;
	}
};
ImageWindow.addEvent(window, "load", ImageWindow.set);var bookPlayer = {

	//    Properties
	//-------------------------------------------------------
	pass: "/looksbook/mini.swf",
	param: "",
	width: "800",
	height: "150",
	quality: "heigh",
	wmode: "transparent",
	bgcolor: "#000000",
	scale: "showall",
	type: "",
	name: "",


	//-------------------------------------------------------
	//    Start
	//-------------------------------------------------------
	start: function() {
		var id = document.body.id;
		if ((id != "irielife") && (id != "irieberry")) { return;}
		bookPlayer.setType(id);
		bookPlayer.embed();
	},


	//-------------------------------------------------------
	//    Set type
	//-------------------------------------------------------
	setType: function(_type) {
		bookPlayer.param = "dir=/looksbook/data/mini/" + _type;
		bookPlayer.type = _type;
		if (_type == "irielife") { bookPlayer.name = "irie_life";}
		if (_type == "irieberry") { bookPlayer.name = "irie_berry";}
	},

	//-------------------------------------------------------
	//    Embed
	//-------------------------------------------------------
	embed: function() {
		var html = "";
		html += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + bookPlayer.width + "' height='" + bookPlayer.height + "' align='middle'>";
		html += "<param name='allowScriptAccess' value='sameDomain'>";
		html += "<param name='movie' value='" + bookPlayer.pass + "'>";
		html += "<param name='quality' value='" + bookPlayer.quality + "'>";
		html += "<param name='wmode' value='" + bookPlayer.wmode + "'>";
		html += "<param name='bgcolor' value='" + bookPlayer.bgcolor + "'>";
		html += "<param name='scale' value='" + bookPlayer.scale + "'>";
		html += "<param name='FlashVars' value='" + bookPlayer.param + "'>";
		html += "<embed ";
		html += " src='" + bookPlayer.pass + "' ";
		html += " quality='" + bookPlayer.quality + "' ";
		html += " wmode='" + bookPlayer.wmode + "' ";
		html += " bgcolor='" + bookPlayer.bgcolor + "' ";
		html += " width='" + bookPlayer.width + "' height='" + bookPlayer.height + "' ";
		html += " scale='" + bookPlayer.scale + "' ";
		html += " FlashVars='" + bookPlayer.param + "' ";
		html += " align='middle' ";
		html += " allowScriptAccess='sameDomain' ";
		html += " type='application/x-shockwave-flash' ";
		html += " pluginspage='http://www.macromedia.com/go/getflashplayer'>";
		html += "</embed>";
		html += "</object>";
		var css = "position: relative; top: -150px; width: 800px; display: block; height: 150px; padding-top: 155px;";
		if (/*@cc_on!@*/false) {
			css += "background-color: #000; filter: alpha(opacity=0);";
		}
		html += "<a href='javascript:open_" + bookPlayer.type + "()' style='" + css + "'>Book</a>";
		if (document.getElementById("minibook")) {
			var flash = document.getElementById("minibook");
		} else {
			var flash = document.createElement("div");
		}
		flash.id = "minibook";
		flash.style.display = "block";
		flash.style.width = bookPlayer.width + "px";
		flash.style.height = bookPlayer.height + "px";
		document.getElementById("page-top").style.height = "355px";
		document.getElementById("gn").style.height = "330px";
		flash.innerHTML = html;
		document.getElementById("gn").appendChild(flash);
	}

}
function open_irielife() {
	var args = new Array();
	args[0] = "/looksbook/frame.swf?dir=irie_life";
	args[1] = "";
	args[2] = 1000;
	args[3] = 700;
	NewWindow.open(args);
}
function open_irieberry() {
	var args = new Array();
	args[0] = "/looksbook/frame.swf?dir=irie_berry";
	args[1] = "";
	args[2] = 1000;
	args[3] = 700;
	NewWindow.open(args);
}
DomHTML.addEvent(window, "load", bookPlayer.start);


//----------------------------------------------------------
//  Embed Flash ver 0.91
//----------------------------------------------------------
var embedFlash = {

	//-------------------------------------------------------
	//    Properties
	//-------------------------------------------------------
	htmlID: "",
	pass: "",
	width: "",
	height: "",
	quality: "",
	wmode: "",
	bgcolor: "",
	scale: "",
	flash: "",


	//-------------------------------------------------------
	//    Constructor
	//-------------------------------------------------------
	start: function() {
	
	},


	//-------------------------------------------------------
	//    
	//-------------------------------------------------------
	setProperties: function(_pass, _width, _height, _quality, _wmode, _bgcolor, _scale, _htmlID) {
		embedFlash.pass = _pass;
		embedFlash.width = _width;
		embedFlash.height = _height;
		embedFlash.quality = _quality;
		embedFlash.wmode = _wmode;
		embedFlash.bgcolor = _bgcolor;
		embedFlash.scase = _scale;
		embedFlash.htmlID = _htmlID || "";
	},

	//-------------------------------------------------------
	//    Create
	//-------------------------------------------------------
	create: function() {
		var html = "";

		html += "<img src='" + embedFlash.pass + "' width='" + embedFlash.width + "' />";
		/*
		html += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + embedFlash.width + "' height='" + embedFlash.height + "' align='middle'>";
		html += "<param name='allowScriptAccess' value='sameDomain'>\n";
		html += "<param name='movie' value='" + embedFlash.pass + "'>\n";
		html += "<param name='quality' value='" + embedFlash.quality + "'>\n";
		html += "<param name='wmode' value='" + embedFlash.wmode + "'>\n";
		html += "<param name='bgcolor' value='" + embedFlash.bgcolor + "'>\n";
		html += "<param name='scale' value='" + embedFlash.scale + "'>\n";
		html += "<embed";
		html += " src='" + embedFlash.pass + "' ";
		html += " quality='" + embedFlash.quality + "' ";
		html += " wmode='" + embedFlash.wmode + "' ";
		html += " bgcolor='" + embedFlash.bgcolor + "' ";
		html += " width='" + embedFlash.width + "' height='" + embedFlash.height + "' ";
		html += " scale='" + embedFlash.scale + "' ";
		html += " align='middle' ";
		html += " allowScriptAccess='sameDomain' ";
		html += " type='application/x-shockwave-flash' ";
		html += " pluginspage='http://www.macromedia.com/go/getflashplayer'>\n";
		html += "</embed>\n";
		html += "</object>\n";
		*/

		//  onclick
		var css = "display: block; position: relative; top: -" + embedFlash.height + "px; width: " + embedFlash.width + "px; padding-top: " + (parseInt(embedFlash.height)+5) + "px;";
		if (/*@cc_on!@*/false) { css += "background-color: #000; filter: alpha(opacity=0);";}
		html += "<a href='javascript: embedFlash.openLooksbook()' style='" + css + "'>Looks book</a>";

		embedFlash.flash = document.createElement("div");
		embedFlash.id = embedFlash.htmlID;
		embedFlash.flash.style.width = embedFlash.width + "px";
		embedFlash.flash.style.height = embedFlash.height + "px";
		embedFlash.flash.style.overflow = "hidden";
		embedFlash.flash.innerHTML = html;
	},


	//-------------------------------------------------------
	//    Open looksbook
	//-------------------------------------------------------
	openLooksbook: function () {
		var args = new Array();
		args[0] = "/looksbook/";
		args[1] = "";
		args[2] = 1000;
		args[3] = 700;
		NewWindow.open(args);
	},


	//-------------------------------------------------------
	//    Embed
	//-------------------------------------------------------
	embed: function() {
		if (!document.getElementById("mc-notice-movie")){ return;}
		document.getElementById("mc-notice-movie").appendChild(embedFlash.flash);
	},

	//-------------------------------------------------------
	//    Add event
	//-------------------------------------------------------
	addEvent: function(elemObj, eventType, funcName, useCapture) {
		if (elemObj.addEventListener){
			elemObj.addEventListener(eventType, funcName, useCapture);
			return true;
		} else if (elemObj.attachEvent){
			var r = elemObj.attachEvent("on"+eventType, funcName);
			return r;
		}
	} 
}
var fileURI = "/images/looksbook_banner.gif";
embedFlash.setProperties(fileURI, "490", "185", "high", "transparent", "#000000", "showall", "book");
embedFlash.create();
embedFlash.addEvent(window, "load", embedFlash.embed);

//----------------------------------------------------------
//  Embed Flash2
//----------------------------------------------------------
var embedFlash2 = {

	//-------------------------------------------------------
	//    Properties
	//-------------------------------------------------------
	htmlID: "",
	pass: "",
	width: "",
	height: "",
	quality: "",
	wmode: "",
	bgcolor: "",
	scale: "",
	flash: "",


	//-------------------------------------------------------
	//    Constructor
	//-------------------------------------------------------
	start: function() {
	
	},


	//-------------------------------------------------------
	//    
	//-------------------------------------------------------
	setProperties: function(_pass, _width, _height, _quality, _wmode, _bgcolor, _scale, _htmlID) {
		embedFlash2.pass = _pass;
		embedFlash2.width = _width;
		embedFlash2.height = _height;
		embedFlash2.quality = _quality;
		embedFlash2.wmode = _wmode;
		embedFlash2.bgcolor = _bgcolor;
		embedFlash2.scase = _scale;
		embedFlash2.htmlID = _htmlID || "";
	},

	//-------------------------------------------------------
	//    Create
	//-------------------------------------------------------
	create: function() {
		var html = "";
		html += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + embedFlash2.width + "' height='" + embedFlash2.height + "' align='middle'>";
		html += "<param name='allowScriptAccess' value='sameDomain'>\n";
		html += "<param name='movie' value='" + embedFlash2.pass + "'>\n";
		html += "<param name='quality' value='" + embedFlash2.quality + "'>\n";
		html += "<param name='wmode' value='" + embedFlash2.wmode + "'>\n";
		html += "<param name='bgcolor' value='" + embedFlash2.bgcolor + "'>\n";
		html += "<param name='scale' value='" + embedFlash2.scale + "'>\n";
		html += "<embed";
		html += " src='" + embedFlash2.pass + "' ";
		html += " quality='" + embedFlash2.quality + "' ";
		html += " wmode='" + embedFlash2.wmode + "' ";
		html += " bgcolor='" + embedFlash2.bgcolor + "' ";
		html += " width='" + embedFlash2.width + "' height='" + embedFlash2.height + "' ";
		html += " scale='" + embedFlash2.scale + "' ";
		html += " align='middle' ";
		html += " allowScriptAccess='sameDomain' ";
		html += " type='application/x-shockwave-flash' ";
		html += " pluginspage='http://www.macromedia.com/go/getflashplayer'>\n";
		html += "</embed>\n";
		html += "</object>\n";

		//  onclick
		//var css = "display: block; position: relative; top: -" + embedFlash2.height + "px; width: " + embedFlash2.width + "px; padding-top: " + (parseInt(embedFlash2.height)+5) + "px;";
		//if (/*@cc_on!@*/false) { css += "background-color: #000; filter: alpha(opacity=0);";}
		//html += "<a href='javascript: embedFlash2.openLooksbook()' style='" + css + "'>aa</a>";

		embedFlash2.flash = document.createElement("div");
		embedFlash2.id = embedFlash2.htmlID;
		embedFlash2.flash.style.width = embedFlash2.width + "px";
		embedFlash2.flash.style.height = embedFlash2.height + "px";
		embedFlash2.flash.style.overflow = "hidden";
		embedFlash2.flash.innerHTML = html;
	},


	//-------------------------------------------------------
	//    Open looksbook
	//-------------------------------------------------------
	openLooksbook: function () {
		var args = new Array();
		args[0] = "/looksbook/";
		args[1] = "";
		args[2] = 1000;
		args[3] = 700;
		NewWindow.open(args);
	},


	//-------------------------------------------------------
	//    Embed
	//-------------------------------------------------------
	embed: function() {
		if (!document.getElementById("mc-newarrival-movie")){ return;}
		document.getElementById("mc-newarrival").style.height = embedFlash2.height + "px";
		document.getElementById("mc-newarrival-movie").appendChild(embedFlash2.flash);
	},

	//-------------------------------------------------------
	//    Add event
	//-------------------------------------------------------
	addEvent: function(elemObj, eventType, funcName, useCapture) {
		if (elemObj.addEventListener){
			elemObj.addEventListener(eventType, funcName, useCapture);
			return true;
		} else if (elemObj.attachEvent){
			var r = elemObj.attachEvent("on"+eventType, funcName);
			return r;
		}
	} 
}
/*
var fileURI = "/images/newarrival.swf";
embedFlash2.setProperties(fileURI, "760", "100", "high", "#000000", "#000000", "showall", "book");
embedFlash2.create();
embedFlash2.addEvent(window, "load", embedFlash2.embed);
*/