/* ------------------------------
 conf
------------------------------ */

// load files
var LDJSF = [
	{'src': 'jquery.js', 'charset': 'ISO-8859-1'},
	{'src': 'jquery.rollover.js', 'charset': 'UTF-8'},
	{'src': 'smoothScroll.js', 'charset': 'ISO-8859-1'},
	{'src': 'heightLine.js', 'charset': 'ISO-8859-1'},	
//	{'src': 'fixed.js', 'charset': 'ISO-8859-1'},
	{'src': 'swfobject/swfobject.js', 'charset': 'ISO-8859-1'},
	{'src': 'jquery.nyroModal-1.5.1.js', 'charset': 'ISO-8859-1'}
];



/* ------------------------------
 not modify here.
------------------------------ */
var scTag = document.getElementsByTagName('script');
var jsDir = '';
var len = scTag.length;
for(var i = 0; i < len; i++){
	var s = scTag[i];
	if(s.src && s.src.indexOf('common.js') != -1){
		jsDir = s.src.substring(0,s.src.indexOf('common.js'));
	}
}

len = LDJSF.length;
for(var i = 0; i < len; i++){
	document.write('<script type="text/javascript" src="' + jsDir + LDJSF[i].src + '" charset="' + LDJSF[i].charset + '"></script>');
}


function getCookie(name){
	var start = document.cookie.indexOf(name + "=");
	var len = start + name.length + 1;
	if((!start) && (name != document.cookie.substring(0, name.length))){
		return null;
	}
	if(start == -1){
		return null;
	}
	var end = document.cookie.indexOf(';', len);
	if(end == -1){
		end = document.cookie.length;
	}
	return unescape(document.cookie.substring(len, end));
}

function setCookie(name, value, expires, path, domain, secure){
	var today = new Date();
	today.setTime(today.getTime());
	if(expires){
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date(today.getTime() + (expires));
	document.cookie = name + '=' + escape(value) +
		((expires)? ';expires=' + expires_date.toGMTString() : '') + 
		((path)? ';path=' + path : '') +
		((domain)? ';domain=' + domain : '') +
		((secure)? ';secure' : '');
}

function deleteCookie(name, path, domain){
	if(getCookie(name)){
		document.cookie = name + '=' +
			((path)? ';path=' + path : '') +
			((domain )? ';domain=' + domain : '') +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
	}
}

function implode( glue, pieces ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Waldo Malqui Silva
    // *     example 1: implode(' ', ['Kevin', 'van', 'Zonneveld']);
    // *     returns 1: 'Kevin van Zonneveld'
 
    return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces );
}

function getRequest(){
  if(location.search.length > 1) {
    var get = new Object();
    var ret = location.search.substr(1).split("&");
    for(var i = 0; i < ret.length; i++) {
      var r = ret[i].split("=");
      get[r[0]] = r[1];
    }
    return get;
  } else {
    return false;
  }
}

/* ------------------------------
 showFlash
------------------------------ */
	function showFlash(_contentId){
/*
	var flashvars = {contentId:_contentId};
	var params = {
	quality: "low",
	allowScriptAccess:"always",
	wmode:"transparent"
	};
	var attributes = {};
	
	swfobject.embedSWF("/index.swf", "FL_area", "100%", "100%", "9.0.0","", flashvars, params, attributes);
*/


	if(document.all){
	var h = document.documentElement.clientHeight;
	    }
	else{
	var h = window.innerHeight;
	    }
	document.body.style.height = h + 'px';
//	document.body.style.overflow='hidden';
	document.getElementById('FL_area').style.display = "block";

	document.getElementById('FL_area').innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='100%' height='100%' id='flash'><param name='flashvars' value='contentId="+_contentId+"'><param name='allowScriptAccess' value='always' /><param name='movie' value='/index.swf' /><param name='quality' value='low' /><param name='wmode' value='transparent' /><embed src='/index.swf' flashvars='contentId="+_contentId+"' quality='low' wmode='transparent' width='100%' height='100%' name='flash' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
	
	}
	

/* ------------------------------
 closeFlashObj
------------------------------ */
	function closeFlashObj(){
		document.body.style.height = '100%';
//		document.body.style.overflow='visible';
		document.getElementById('FL_area').style.display = 'none';
	}

/* ------------------------------
 showPhotolog
------------------------------ */
	function showPhotolog(_contentId){
	if(document.all){
	var h = document.documentElement.clientHeight;
	    }
	else{
	var h = window.innerHeight;
	    }
	document.body.style.height = h + 'px';
//	document.body.style.overflow='hidden';
	document.getElementById('PL_area').style.display = "block";
	document.getElementById('PL_area').innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='100%' height='100%' id='photolog'><param name='flashvars' value='rootpath=/&category="+_contentId+"'><param name='allowScriptAccess' value='always' /><param name='movie' value='/photolog/index.swf' /><param name='quality' value='high' /><param name='wmode' value='transparent' /><embed src='/photolog/index.swf' flashvars='rootpath=/&category="+_contentId+"' quality='high' wmode='transparent' width='100%' height='100%' name='photolog' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";

	}
	
/* ------------------------------
 closePhotolog
------------------------------ */
	function closePhotolog(){
		document.body.style.height = '100%';
//		document.body.style.overflow='visible';
		document.getElementById('PL_area').style.display = 'none';
	}








var Flash = function () {
	var o = {installed:0, version:[]}, description, oActiveX, nMajor, nMinor;
	if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
		o.pluginType = "npapi";
		description = navigator.plugins["Shockwave Flash"].description;
		if (typeof description != "undefined") {
			description = description.replace(/^.*¥s+(¥S+¥s+¥S+$)/, "$1");
			nMajor = parseInt(description.replace(/^(.*)¥..*$/, "$1"), 10);
			nMinor = /r/.test(description) ? parseInt(description.replace(/^.*r(.*)$/, "$1"), 10) : 0;
			o.version = [nMajor, nMinor];
			o.installed = 1;
		}
	}else if (window.ActiveXObject) {
		o.pluginType = "ax";
		try {
			oActiveX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch (e) {
			try {
				oActiveX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				o.version = [6, 0];
				o.installed = 1;
				oActiveX.AllowScriptAccess = "always";
			}catch (e) {
				if (o.version[0] == 6) {o.installed=1; return; }
			}
			try {
				oActiveX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			}catch (e) {
			}
		}
		if (typeof oActiveX == "object") {
			description = oActiveX.GetVariable("$version");
			if (typeof description != "undefined") {
				description = description.replace(/^¥S+¥s+(.*)$/, "$1").split(",");
				o.version = [parseInt(description[0], 10), parseInt(description[2], 10)];
				o.installed = 1;
			}
		}
	}
	return o;
}();