﻿function E$(a) { return document.getElementById(a)}
function gourl(u) { window.location=u; }
function openURL(url) { window.open(url, 'newwin');  }
function switch_lang(a, b) {
	var c = window.location.toString().substr(0).replace("/" + a + "/", "/" + b + "/");
	window.location = c
}
function is_cn() {
	var a = window.location.toString();
	return a.indexOf("/tc/") > 0 || a.indexOf("/sc/") > 0 ? true : false
}
function isie6() {
	var a = navigator.appVersion.split("MSIE");
	a = parseFloat(a[1]);
	return a >= 5.5 && a < 7
}
function isie7() {
	var a = navigator.appVersion.split("MSIE");
	a = parseFloat(a[1]);
	return a >= 6.5 && a < 8
}
function switchimgsrc(a, b, c, f) {
	var k = parseFloat(navigator.appVersion.split("MSIE")[1]);
	if (k >= 5.5 && k < 7 && document.body.filters) {
		a.src = b;
		a.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + b + "', sizingMethod='scale');";
		if (c > 0) {
			a.style.width = c + "px";
			if (f > 0) 
				a.style.height = f + "px"
		}
	} else
		a.src = b
}
function setdisplay(a, b) {
	a.style.display = b ? "" : "none"
}


function setholderbg(a, b) {
	var c = document.getElementById(a).offsetHeight,
	f = navigator.userAgent.toLowerCase().indexOf("chrome") > -1,
	k = navigator.userAgent.toLowerCase().indexOf("safari") > -1;
	if (f || k) 
		c = 0;
	document.getElementById(b).style.height = c + "px"
}
function setholderbg2(a, b, c) {
	a = document.getElementById(a).offsetHeight;
	document.getElementById(b).style.height = a + c + "px"
}
function setresultbg(a, b) {
	setholderbg(a, b)
}
function setbg_until_allimg_loaded(a, b) {
	for (var c = true, f = 0; f < document.images.length; f++) 
		document.images[f].complete || (c = false);
	if (c) {
		setholderbg(a, b);
		document.getElementById(b).style.display = ""
	} else
		setTimeout("setbg_until_allimg_loaded('" + a + "','" + b + "')", 500)
};
//Cookies
function setCookie(c_name,value,exdays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie=c_name + "=" + c_value+"; path=/";
}
function getCookie(c_name)
{
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++)
	{
	  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
	  x=x.replace(/^\s+|\s+$/g,"");
	  if (x==c_name)
		{
		return unescape(y);
		}
	  }
}
//Cookies for homepage
function Set_Cookie(a, b, c, f, k, m) {
	var n = new Date;
	n.setTime(n.getTime());
	if (c) 
		c = c * 1E3 * 60 * 60;
	n = new Date(n.getTime() + c);
	document.cookie = a + "=" + escape(b) + (c ? ";expires=" + n.toGMTString() : "") + (f ? ";path=" + f : "") + (k ? ";domain=" + k : "") + (m ? ";secure" : "")
}
function Get_Cookie(a) {
	var b = document.cookie.split(";"),
	c = "",
	f = "",
	k = "";
	for (i = 0; i < b.length; i++) {
		c = b[i].split("=");
		f = c[0].replace(/^\s+|\s+$/g, "");
		if (f == a) {
			if (c.length > 1) 
				k = unescape(c[1].replace(/^\s+|\s+$/g, ""));
			return k
		}
	}
	return null
}
//PNG
function correctPNG() {
	var a = navigator.appVersion.split("MSIE");
	a = parseFloat(a[1]);
	if (a >= 5.5 && a < 7 && document.body.filters) 
		for (a = 0; a < document.images.length; a++) {
			var b = document.images[a],
			c = b.src.toUpperCase();
			if (c.substring(c.length - 3, c.length) == "PNG") {
				c = b.id ? "id='" + b.id + "' " : "";
				var f = b.className ? "class='" + b.className + "' " : "",
				k = b.title ? "title='" + b.title + "' " : "title='" + b.alt + "' ",
				m = "display:inline-block;" + b.style.cssText;
				if (b.align == "left") 
					m = "float:left;" + m;
				if (b.align == "right") 
					m = "float:right;" + m;
				if (b.parentElement.href) 
					m = 
						"cursor:hand;" + m;
				b.outerHTML = "<span " + c + f + k + ' style="width:' + b.width + "px; height:" + b.height + "px;" + m + ";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + b.src + "', sizingMethod='crop');\"></span>";
				a -= 1
			}
		}
}
//AJAX
var browser = navigator.appName;
browser == "Microsoft Internet Explorer" && window.attachEvent("onload", correctPNG);
function GetXmlHttpObject() {
	var a = null;
	try {
		a = new XMLHttpRequest
	} catch (b) {
		try {
			a = new ActiveXObject("Msxml2.XMLHTTP")
		} catch (c) {
			a = new ActiveXObject("Microsoft.XMLHTTP")
		}
	}
	return a
}
function stateChanged(a, b) {
	if (b.readyState == 4) {
		a.innerHTML = b.responseText;
		if (a.id == "info_tab_content") {
			scroller.init();
			correctPNG()
		}
	}
}
function ajax_loadcontent(a, b) {
	var c = GetXmlHttpObject(),
	f = document.getElementById(a);
	f.innerHTML = "<div style='margin-top: 150px; margin-left: 200px'></div>";
	c.onreadystatechange = function () {
		stateChanged(f, c)
	};
	c.open("GET", b, true);
	c.send(null)
}
//Links Tab
var sel_linkstab = 0, linkstab_imgs = ["tab_exhibitorsCentre", "tab_mediaCentre", "tab_otherCulturalEvents"], linkstab_imgw = [142, 103, 162], linkstab_imgw_d = [268, 204, 304], linkstabcn_imgw = [72, 58, 87], linkstabcn_imgw_d = [153, 126, 183], linkstab_imgh = 22, linkstabcn_imgh = 27;
function linkstab_hover(a) {
	if (sel_linkstab != a) {
		var b = document.getElementById("linkstab_" + a);
		switchimgsrc(b, "images/" + linkstab_imgs[a] + "_mouseOver.png", -1)
	}
}
function linkstab_out(a) {
	if (sel_linkstab != a) {
		var b = document.getElementById("linkstab_" + a);
		switchimgsrc(b, "images/" + linkstab_imgs[a] + ".png", -1)
	}
}
function linkstab_select(a) {
	var b = document.getElementById("linkstab_" + a),
	c = "images/" + linkstab_imgs[a] + "_d.png";
	parseFloat(navigator.appVersion.split("MSIE")[1]);
	sel_linkstab = a;
	for (var f = 0; f <= 2; f++) 
		is_cn() ? switchimgsrc(document.getElementById("linkstab_" + f), "images/" + linkstab_imgs[f] + ".png", linkstabcn_imgw[f], linkstabcn_imgh) : switchimgsrc(document.getElementById("linkstab_" + f), "images/" + linkstab_imgs[f] + ".png", linkstab_imgw[f], linkstab_imgh);
	if (a == 0) 
		b.style.marginLeft = "0px";
	else
		document.getElementById("linkstab_0").style.marginLeft = 
			"5px";
	is_cn() ? switchimgsrc(b, c, linkstabcn_imgw_d[a], linkstabcn_imgh) : switchimgsrc(b, c, linkstab_imgw_d[a], linkstab_imgh);
	document.getElementById("links_tab_content").innerHTML = document.getElementById("link_tab" + a).innerHTML
}
//TINY BOX
var TINY = {
};
function T$(a) {
	return document.getElementById(a)
}
TINY.box = function () {
	var a,
	b,
	c,
	f,
	k,
	m,
	n,
	p,
	q = 0;
	return{
		show : function (d, e, g, h, l, j) {
			if (!q) {
				a = document.createElement("div");
				a.id = "tinybox";
				b = document.createElement("div");
				b.id = "tinymask";
				c = document.createElement("div");
				c.id = "tinycontent";
				document.body.appendChild(b);
				document.body.appendChild(a);
				a.appendChild(c);
				b.onclick = TINY.box.hide;
				window.onresize = TINY.box.resize;
				q = 1
			}
			if (!l && !e) {
				a.style.width = g ? g + "px" : "auto";
				a.style.height = h ? h + "px" : "auto";
				a.style.backgroundImage = "none";
				c.innerHTML = d
			} else {
				c.style.display = 
					"none";
				a.style.width = a.style.height = "100px"
			}
			this.mask();
			f = d;
			k = e;
			m = g;
			n = h;
			p = l;
			this.alpha(b, 1, 80, 3);
			j && setTimeout(function () {
					TINY.box.hide()
				}, 1E3 * j)
		},
		fill : function (d, e, g, h, l) {
			if (e) {
				a.style.backgroundImage = "";
				var j = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");
				j.onreadystatechange = function () {
					j.readyState == 4 && j.status == 200 && TINY.box.psh(j.responseText, g, h, l)
				};
				j.open("GET", d, 1);
				j.send(null)
			} else
				this.psh(d, g, h, l)
		},
		psh : function (d, e, g, h) {
			if (h) {
				if (!e || !g) {
					h = a.style.width;
					var l = a.style.height;
					c.innerHTML = d;
					a.style.width = e ? e + "px" : "";
					a.style.height = g ? g + "px" : "";
					c.style.display = "";
					e = parseInt(c.offsetWidth);
					g = parseInt(c.offsetHeight);
					c.style.display = "none";
					a.style.width = h;
					a.style.height = l
				} else
					c.innerHTML = d;
				this.size(a, e, g)
			} else
				a.style.backgroundImage = "none"
		},
		hide : function () {
			TINY.box.alpha(a, -1, 0, 3)
		},
		resize : function () {
			TINY.box.pos();
			TINY.box.mask()
		},
		mask : function () {
			b.style.height = TINY.page.total(1) + "px";
			b.style.width = "";
			b.style.width = TINY.page.total(0) + "px"
		},
		pos : function () {
			var d = 
				TINY.page.height() / 2 - a.offsetHeight / 2;
			a.style.top = (d < 10 ? 10 : d) + TINY.page.top() + "px";
			a.style.left = TINY.page.width() / 2 - a.offsetWidth / 2 + "px"
		},
		alpha : function (d, e, g) {
			clearInterval(d.ai);
			if (e == 1) {
				d.style.opacity = 0;
				d.style.filter = "alpha(opacity=0)";
				d.style.display = "block";
				this.pos()
			}
			d.ai = setInterval(function () {
					TINY.box.ta(d, g, e)
				}, 20)
		},
		ta : function (d, e, g) {
			var h = Math.round(d.style.opacity * 100);
			if (h == e) {
				clearInterval(d.ai);
				if (g == -1) {
					d.style.display = "none";
					d == a ? TINY.box.alpha(b, -1, 0, 2) : (c.innerHTML = a.style.backgroundImage = 
							"")
				} else
					d == b ? this.alpha(a, 1, 100) : TINY.box.fill(f, k, m, n, p)
			} else {
				e = Math.ceil(h + (e - h) * 0.5);
				e = e == 1 ? 0 : e;
				d.style.opacity = e / 100;
				d.style.filter = "alpha(opacity=" + e + ")"
			}
		},
		size : function (d, e, g) {
			d = typeof d == "object" ? d : T$(d);
			clearInterval(d.si);
			var h = d.offsetWidth,
			l = d.offsetHeight,
			j = h - parseInt(d.style.width),
			o = l - parseInt(d.style.height),
			r = h - j > e ? 0 : 1,
			s = l - o > g ? 0 : 1;
			d.si = setInterval(function () {
					TINY.box.ts(d, e, j, r, g, o, s)
				}, 20)
		},
		ts : function (d, e, g, h, l, j, o) {
			g = d.offsetWidth - g;
			j = d.offsetHeight - j;
			if (g == e && j == l) {
				clearInterval(d.si);
				a.style.backgroundImage = "none";
				c.style.display = "block"
			} else {
				if (g != e) {
					e = g + (e - g) * 0.5;
					d.style.width = h ? Math.ceil(e) + "px" : Math.floor(e) + "px"
				}
				if (j != l) {
					e = j + (l - j) * 0.5;
					d.style.height = o ? Math.ceil(e) + "px" : Math.floor(e) + "px"
				}
				this.pos()
			}
		}
	}
}
();
TINY.page = function () {
	return{
		top : function () {
			return document.documentElement.scrollTop || document.body.scrollTop
		},
		width : function () {
			return self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
		},
		height : function () {
			return self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
		},
		total : function (a) {
			var b = document.body,
			c = document.documentElement;
			return a ? Math.max(Math.max(b.scrollHeight, c.scrollHeight), Math.max(b.clientHeight, c.clientHeight)) : Math.max(Math.max(b.scrollWidth, 
					c.scrollWidth), Math.max(b.clientWidth, c.clientWidth))
		}
	}
}
();
 
