var IE = /*@cc_on!@*/false;
var IE6 = (IE && (navigator['appVersion'].indexOf('MSIE 6') > 0)) ? true : false;


function max(a, b){
	return (a>b)?a:b;
}

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('w L=17(){w b=n.18.I();w c={u:(b.t("M")>-1)?{b:k}:4,N:(n.S)?{b:n.S.I().t("u")}:4,C:(b.t("C")>-1)?{b:k}:4,D:n.J!=y&&n.J.I().t("D")>-1,5:(b.t("5")>-1)?{b:k}:4,B:(b.t("B")>-1)?{b:k}:4,O:E.T!=y&&E.T.t("O")>-1,f:k,g:k,z:4};c.F=c.u||c.D;c.r=(!c.u&&n.J!=y&&n.J.I()=="r")?{b:k}:4;l(c.r){c.r.19=A G(b.m(/.*r\\/(\\d{8}).*/)[1]);c.r.q=A G(b.m(/.*r\\/(\\d{8}).*/)[1]);c.H=(b.t("H")>-1)?{b:k}:4;l(c.H){c.H.q=b.m(/.* H\\/(\\d+) */)[1]}}l(c.5){c.5.q=A G(b.m(/.*5(\\s|\\/)(\\d+\\.\\d+)/)[2])}l(!c.5&&P.5){c.5=k;c.C=4;c.v=4;c.r=4;c.5.q=P.5.q()}c.v=(b.t("U")>-1&&!c.5&&!c.F&&!c.r)?{b:k}:4;c.o=c.v&&b.m(/.*F.*/)!=y;l(c.v||(c.5&&c.5.q<7.6)){c.g=4}l(c.v){c.v.q=b.m(/.* U ([*0-9]\\.[*0-9])*/)[1]}l(c.u){c.u.q=A G(b.m(/.*M\\/(\\d+).*/)[1])}l(c.C){c.C.q=A G(b.m(/.*M\\/(\\d+).*/)[1])}l(c.B){c.B.q=b.m(/.*B V (\\d+)W(\\d+).*/)[1]+"."+b.m(/.*B V (\\d+)W(\\d+).*/)[2]}l(n.Q&&n.Q["X/x-Y-z"]&&n.Q["X/x-Y-z"].1a&&(!c.v||c.o)){w d=(n.Z["11 R 2.0"]||n.Z["11 R"]).1b;c.z={b:k};c.z.q=1c(d.m(/.* R (\\d+).*/)[1],10)}1d{w f=4;12{w x=A 13("K.K");1e(w i=3;x!=y;i++){x=A 13("K.K."+i);f=i}}14(e){}l(f)c.z={b:k};c.z.q=(f)?f:4}l(b.m(/.*(1f|F).*/)==y||c.o||c.D||(c.5&&(b.m(/.*F.*/)!=y||c.i<7.6))||(c.N&&c.h<7)||(!c.N&&c.u&&c.15<1g)||(c.r&&c.j<1h)){c.f=4}l(!c.o&&!c.r&&E.16){12{E.16(a,"i").1i=""}14(e){c.O=k}}c.p=c.D||(c.u&&c.15<1j)||c.v;1k c};E.L=P.L();',62,83,'||||false|opera|||||||||||||||true|if|match|navigator|||version|gecko||indexOf|apple|ie|var||null|flash|new|iphone|webkit|konqueror|document|mac|Number|firefox|toLowerCase|product|ShockwaveFlash|agent|applewebkit|safari|xml|window|mimeTypes|Flash|vendor|contentType|msie|os|_|application|shockwave|plugins||Shockwave|try|ActiveXObject|catch|appleversion|createElementNS|function|userAgent|date|enabledPlugin|description|parseInt|else|for|windows|124|20020523|innerHTML|312|return'.split('|'),0,{}))

var IE = /*@cc_on!@*/false;
var IE6 = (IE && (navigator['appVersion'].indexOf('MSIE 6') > 0)) ? true : false;

//	later standalone
var later = function (_o, _s, _m) {
	var that = _o,
		args = Array.prototype.slice.apply(arguments, [3]);
	if (typeof _m === 'string')_m = that[_m];
	time = setTimeout(function () {_m.apply(that, args);}, _s);
	return time;	
};

//	later in jQuery
$.fn.extend({
	later: function(_s, _m){	
		later(this, _s, _m);
		return this;
	}
});

jQuery.cookie = {
	set: function(name, value, expires, path, domain, secure) {
		var now = new Date();	
		var base = new Date(0);
		var skew = base.getTime();
		if (skew > 0)
			date.setTime(date.getTime() - skew);		
		
		now.setTime(now.getTime() + expires);
		var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + now.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
		document.cookie = curCookie;
	},
	get: function(name) {
		var dc = document.cookie;
		var prefix = name + "=";
		var begin = dc.indexOf("; " + prefix);
		if (begin == -1) {
			begin = dc.indexOf(prefix);
			if (begin != 0) return null;
		} else
			begin += 2;
		var end = document.cookie.indexOf(";", begin);
		if (end == -1)
			end = dc.length;
		return unescape(dc.substring(begin + prefix.length, end));
	},
	del: function(name, path, domain) {
		if (this.get(name)) {
			document.cookie = [name,"=",((path) ? "; path=" + path : ""),((domain) ? "; domain=" + domain : ""),"; expires=Thu, 01-Jan-70 00:00:01 GMT"].join('');
		}
	}
};


String.prototype.reverse = function() {
    var res = "";
    for (var i = this.length; i > 0; --i) {
        res += this.charAt(i - 1);
    }
    return res;
}

Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
};
// events
$.fn.extend({
	target: function(){
		return this[0].target || this[0].srcElement;
	},
	stopPropagation: function() {
		if (this[0].stopPropagation) {
		  this[0].stopPropagation();
		} 
		else {
		  this[0].cancelBubble = true;
		}
	},
	preventDefault: function() {
		if (this[0].preventDefault) {
		  this[0].preventDefault();
		} 
		else {
		  this[0].returnValue = false;
		}
	},
	stopEvent: function() {
		this.stopPropagation(this[0]);
		this.preventDefault(this[0]);
	}, 	
	
	pointerX: function() {
		return this[0].pageX || (this[0].clientX +
		  (document.documentElement.scrollLeft || document.body.scrollLeft));
	},
	pointerY: function() {
		return this[0].pageY || (this[0].clientY +
		  (document.documentElement.scrollTop || document.body.scrollTop));
	}
});

function getURLParam(strParamName) {
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 ){
	    var strQueryString = strHref.substr(strHref.indexOf("?"));
	    var aQueryString = strQueryString.split("&");
	    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ) {
	    	if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ) {
				var aParam = aQueryString[iParam].split("=");
		        strReturn = aParam[1];
		        break;
			}
		}
	}
	return unescape(strReturn);
};

function getAdvFromURL() {
	if (getURLParam('video') != "") {
		loadFile({file:'/download/flv/' + getURLParam('video') + '.flv'}, getURLParam('title'));
	}
}

function loadFile(obj, title) {
	thisMovie("adv").loadFile(obj);
	$('#flv_title')[0].innerHTML = title;
	window.scrollTo(0,0);
	thisMovie("adv").sendEvent('playpause');
};

function thisMovie(movieName) {
    if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
};

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
	for(var i=0; i<document.images.length; i++)	{
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
			var imgID = (img.id) ? "id='" + img.id + "' " : ""
			var imgClass = (img.className) ? "class='" + img.className + "' " : ""
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			var imgStyle = "display:inline-block;" + img.style.cssText
			if (img.align == "left") imgStyle = "float:left;" + imgStyle
			if (img.align == "right") imgStyle = "float:right;" + imgStyle
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
			var strNewHTML = "<span " + imgID + imgClass + imgTitle
			+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
			img.outerHTML = strNewHTML
			i = i-1;		
		}
	}
}



function embedFontCallback(id, w, h, evt) {
	if (!evt) {
		$(((false) ? 'object#' : 'embed#') + id).width(w).height(h);
	} else if (evt == 'click') {
		//alert('flashclicked: ' + id);
	}
}

var Site = function() {
	
	var noflash = !document.agent.flash || parseInt(document.agent.flash.version,10)<8;
	

	function promorotator() {
		Site.promoimg0num = $('div#promoimg0 a.promoimg').length;		
		setInterval(function() {
			var i0 = parseInt($('div#promoimg0')[0].className.split('promoimg_')[1], 10);
			var i1 = (i0+1) % Site.promoimg0num;
			$('div#promoimg0').removeClass('promoimg_'+i0);
			$('div#promoimg0').addClass('promoimg_'+i1);
		}, 11000);

		Site.promoimg1num = $('div#promoimg1 a.promoimg').length;		
		setInterval(function() {
			var i0 = parseInt($('div#promoimg1')[0].className.split('promoimg_')[1], 10);
			var i1 = (i0+1) % Site.promoimg1num;
			$('div#promoimg1').removeClass('promoimg_'+i0);
			$('div#promoimg1').addClass('promoimg_'+i1);
		}, 9000);

		Site.promoimg2num = $('div#promoimg2 a.promoimg').length;		
		setInterval(function() {
			var i0 = parseInt($('div#promoimg2')[0].className.split('promoimg_')[1], 10);
			var i1 = (i0+1) % Site.promoimg2num;
			$('div#promoimg2').removeClass('promoimg_'+i0);
			$('div#promoimg2').addClass('promoimg_'+i1);
		}, 9000);

		Site.promoimg3num = $('div#promoimg3 a.promoimg').length;		
		setInterval(function() {
			var i0 = parseInt($('div#promoimg3')[0].className.split('promoimg_')[1], 10);
			var i1 = (i0+1) % Site.promoimg3num;
			$('div#promoimg3').removeClass('promoimg_'+i0);
			$('div#promoimg3').addClass('promoimg_'+i1);
		}, 9000);
	}

	/*
	 * 	font replacement to flash, based on css parameters: 
	 * 		font-size, 
	 * 		color
	 */
	 
	function menuHover() {
		$('div.head div.menu > ul > li').hover(
			function(){
				$(this).addClass('hover');
//				$(this).find('ul').css({'display', 'block'});
			},
			function(){
				$(this).removeClass('hover');
//				$(this).find('ul').css({'display', 'none'});
			}
		);
	}

	function torgb(rgb) {
		if (!rgb) {rgb = '#000000'};
		rgb = rgb.split('#').join('');
		if (rgb.indexOf('rgb') >= 0) {
			var h = '0123456789abcdef';
			var d = rgb.split('rgb(')[1].split(')')[0].split(' ').join('').split(',');
			rgb = h[d[0] >> 4] + h[d[0] % 16] + h[d[1] >> 4] + h[d[1] % 16] + h[d[2] >> 4] + h[d[2] % 16];
		}
		if (3 == rgb.length) {
			rgb = rgb.charAt(0) + rgb.charAt(0) + rgb.charAt(1) + rgb.charAt(1) + rgb.charAt(2) + rgb.charAt(2);
		}
		return '0x' + rgb;
	}

	function embedFont() {
		if (noflash) return false;
		var tmp = null;
		var id = '';
		var ih = '';
		var flashvars = '';
		var attrib = {
			button: {font: 'Djuice Section-H', size: '12', letterSpacing: '0', upperCase: 'false', textColor: '0xffffff', dropShadow: '0x666666', hoverTextColor: '0xffffff', hoverDropShadow: '0x666666'},
			mainmenu: {font: 'VAGRounded_PFL', size: '12', letterSpacing: '0', upperCase: 'true', textColor: '0x666666', dropShadow: '0xffffff', hoverTextColor: '0xffffff', hoverDropShadow: '0x666666'},
			title: {font: 'VAGRounded_PFL', size: '32', letterSpacing: '0', upperCase: 'true', textColor: '0x000000', maxWidth: '500'},
			title2: {font: 'VAGRounded_PFL', size: '32', letterSpacing: '0', upperCase: 'false', textColor: '0x000000', maxWidth: '500'},
//			footinfo: {font: 'Djuice Section-H', size: '10', letterSpacing: '0', upperCase: 'false', textColor: '0xeeeeee'},
//			footmenu: {font: 'Djuice Section-H', size: '10', letterSpacing: '0', upperCase: 'false', textColor: '0x999999', hoverTextColor: '0x999999'},
			devicewebshopattr: {font: 'VAGRounded_PFL', size: '14', letterSpacing: '0', upperCase: 'true', textColor: '0x666666'},
			devicewebshopvalue: {font: 'VAGRounded_PFL', size: '14', letterSpacing: '0', upperCase: 'true', textColor: '0xf68f37'},
			devicefeatures: {font: 'VAGRounded_PFL', size: '18', letterSpacing: '0', upperCase: 'true', textColor: '0xcccccc'},
			packageselector: {font: 'Djuice Section-H', size: '12', letterSpacing: '0', upperCase: 'false', textColor: '0xffffff', dropShadow: '0x666666', hoverTextColor: '0xffffff', hoverDropShadow: '0x666666'},
			boxtitle: {font: 'Djuice Section-H', size: '18', letterSpacing: '0', upperCase: 'false', textColor: '0xf68f37'},
			sitemaptitle: {font: 'Djuice Section-H', size: '18', letterSpacing: '0', upperCase: 'false', textColor: '0xf68f37', hoverTextColor: '0xffffff'}
		};
		if (String(window.location).indexOf('b3210') > 0) {
			$('div.content h1:not(:has(span))').each(function() {this.innerHTML = this.innerHTML.split('Samsung').join('SAMSUNG'); this.attrib = 'title2'});
		} else {
			$('div.content h1:not(:has(span))').each(function() {this.attrib = 'title'});
		}
//		$('div.head div.func span').each(function() {this.attrib = 'button';});
//		$('div.head div.menu > ul > li b.embedfont').each(function() {this.attrib = 'mainmenu'});
//		$('div.footer div.copy span ins').each(function() {this.attrib = 'footinfo'});
//		$('div.footer div.menu a ins').each(function() {this.attrib = 'footmenu'});
		$('div.content div#deviceWebshop h4 b').each(function() {this.attrib = 'devicewebshopattr'});
		$('div.content div#deviceWebshop h4 strong').each(function() {this.attrib = 'devicewebshopvalue'});
		$('div.content div#deviceFeatureicons li').each(function() {this.attrib = 'devicefeatures'});
		$('div.content div#deviceWebshop td.c4 a span').each(function() {this.attrib = 'button'});
		$('div.content div#packageselector h4').each(function() {this.attrib = 'devicewebshopvalue'});
		$('div.content div#packageselector a span').each(function() {this.attrib = 'packageselector'});
		$('div.content div.boxcol h4').each(function() {this.attrib = 'boxtitle'});
		$('div.content div.button a span').each(function() {this.attrib = 'button'});
		$('div.content div.sitemap h4 a').each(function() {this.attrib = 'sitemaptitle'});
		$('div.mbiform h2').each(function() {this.attrib = 'boxtitle'});

		$('div.content h1:not(:has(span))')
//		$('div.head div.func span')
//		.add('div.head div.menu > ul > li b.embedfont')
//		.add('div.footer div.copy spa1n ins')
//		.add('div.footer div.menu a ins')
		.add('div.content div#deviceWebshop h4 b')
		.add('div.content div#deviceWebshop h4 strong')
		.add('div.content div#deviceFeatureicons li')
//		.add('div.content div#deviceWebshop td.c4 a span')
		.add('div.content div#packageselector h4')
		.add('div.content div#packageselector a span')
		.add('div.content div.boxcol h4')
		.add('div.content div.button a span')
		.add('div.content div.sitemap h4 a')
		.add('div.mbiform h2')
		.each(function(i,s) {
			id = 'embedfont' + String(i);
			flashvars = 'id=' + id;
			flashvars += '&font=' + attrib[s.attrib]['font'];
			flashvars += '&size=' + attrib[s.attrib]['size'];
			flashvars += '&letterSpacing=' + attrib[s.attrib]['letterSpacing'];
			flashvars += '&upperCase=' + attrib[s.attrib]['upperCase'];
			flashvars += '&textColor=' + attrib[s.attrib]['textColor'];
			if (attrib[s.attrib]['dropShadow']) {flashvars += '&dropShadow=' + attrib[s.attrib]['dropShadow'];}
			if (attrib[s.attrib]['hoverTextColor']) {flashvars += '&hoverTextColor=' + attrib[s.attrib]['hoverTextColor'];}
			if (attrib[s.attrib]['hoverDropShadow']) {flashvars += '&hoverDropShadow=' + attrib[s.attrib]['hoverDropShadow'];}
			if (attrib[s.attrib]['wordWrap']) {flashvars += '&wordWrap=' + attrib[s.attrib]['wordWrap'];}
			if (attrib[s.attrib]['maxWidth']) {flashvars += '&maxWidth=' + attrib[s.attrib]['maxWidth'];}
			if (attrib[s.attrib]['leading']) {flashvars += '&leading=' + attrib[s.attrib]['leading'];}
			flashvars += '&callbackFunction=embedFontCallback';
			tmp = $(this).attr('href') || $(this).parent('a').attr('href');
			if (tmp) {
				tmp = String(tmp).split('&amp;').join('&').split('&').join('%26');
				flashvars += '&href=' + tmp;
			}
			flashvars += '&htmlText=' + stringFlashCorrect(s.innerHTML);
//			if (attrib[s.attrib]['clickEvent']) {flashvars += '&clickEvent=' + attrib[s.attrib]['clickEvent'];}

			if (false) {
				ih = '';
				ih += '<object id="' + id + '" name="' + id + '" ' + ((IE) ? 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' : 'type="application/x-shockwave-flash" data="/swf/flashtext.swf"') + '>';
				ih += (IE) ? '<param name="movie" value="/swf/flashtext.swf" />' : '';
				ih += '<param name="wmode" value="transparent" />';
				ih += '<param name="quality" value="high" />';
				ih += '<param name="scale" value="noscale" />';
				ih += '<param name="align" value="tl" />';
				ih += '<param name="allowScriptAccess" value="sameDomain" />';
				ih += '<param name="allowNetworking" value="all" />';
				ih += '<param name="swliveconnect" value="true" />';
				ih += '<param name="flashvars" value="' + stringFlashCorrect(flashvars) + '"/>';
				ih += '</object>';
			} else {
				ih = '<embed id="' + id + '" name="' + id + '" src="/swf/flashtext.swf" quality="high" scale="noscale" align="tl" wmode="transparent" allowScriptAccess="sameDomain" allowNetworking="all" swliveconnect="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + stringFlashCorrect(flashvars) + '" />';
			}
//			this.innerHTML = '';
//			$(this).append(ih);
			this.innerHTML = ih;
//			alert(flashvars.split('&').join('\n'));
		});

		$('div.head div.menu > ul > li').hover(
			function() {
//				$(this).find((false) ? 'object' : 'embed')[0].flashFunction('over');
			},
			function() {
//				$(this).find((false) ? 'object' : 'embed')[0].flashFunction('out');
			}
		);

	}



	function tabsheet()	{
		$('div.tabsheet > dl > dt').click(function() {
			this.parentNode.className = this.className;
		});
	}



	// private
	/*
	function font(_class)
	{

		if( noflash )return false;
				
		$('.'+_class).each(function(i,s){

			_size = parseInt($(s).eq(0).css('font-size'),10);

			if(jQuery.browser.msie){
				_color = $(s).eq(0).css('color');			
			} else {		
				_c_Dec = $(s).eq(0).css('color').match(/(\d{1,3}), (\d{1,3}), (\d{1,3}).* /);
				_color = ['#', parseInt(_c_Dec[1],10).toString(16), parseInt(_c_Dec[2],10).toString(16), parseInt(_c_Dec[3],10).toString(16)].join('');
			}

			var _orig = s.innerHTML;
			_row = Math.round(eval(s.offsetHeight / 20))
			_hrefs = s.getElementsByTagName('a');
			if (_hrefs.length > 0) {
				var text	= _hrefs[0].innerHTML;
				var url		= _hrefs[0].href;
			} else {
				var text	= s.innerHTML;
				var url		= false;
			}	

			s.innerHTML = [
			'<embed src="swf/font_',
			_class,
			'.swf" quality="high"',
			' scale="noscale" salign="lt" wmode="transparent"',
			' bgcolor="#ffffff" width="',
			eval(s.offsetWidth),
			'" height="',
			eval( ( _row * 18 ) + 16 ) ,
			'" name="djuiceFontInstance'+i+'" id="djuiceFontInstance'+i+'" align="left" allowScriptAccess="sameDomain"',
			' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"',
			' flashvars="txt=<font color=\'',
			_color,
			'\' size=\'',
			_size,
			'\'>',
			stringFlashCorrect(text),
			'</font>',
			(!url)?'':'&amp;furl=',
			(!url)?'':url,
			'&amp;objectID=djuiceFontInstance'+i,
			'" title="',
			text,
			'" />'].join("");
		});
	}

	function clearButtons(){
		$('input[type=submit],input[type=button],button').val('');
	}
*/
	function stringFlashCorrect(str) {
		return str.replace(/\&amp;/i, '%26').replace(/\"/i, '%22').replace(/\+/i, '%2B');
	}	
	
	// menu for ie<7	
/*	
	function menu(_selector) {
		$(_selector).hover(function(){
			$(this).find('ul').css('display','block');
			$(this).addClass('hover');
		},function(){
			$(this).removeClass('hover').find('ul').css('display','none');
		});
	}
*/
/*
 * 	altalanos tartalmak cim-lead-visual kep flash csere
 */
/*	
	function initLead(){		
		
		if( noflash )return false;
	
		if( document.agent.ie && parseInt(document.agent.ie.version,10)<7) {
			_a = location.href.split('/');
			_a.pop();
			_a = _a.join('/');
			t_visual = $('div#djuiceLead div').css('filter').match(/.* src=\'(.*)\',.* /)[1];
		} else {
			t_visual = $('div#djuiceLead div').css('backgroundImage').match(/url\((.*)\)/)[1];
		}

		$('div#djuiceLead').html(
		['<embed type="application/x-shockwave-flash" src="swf/djuicetitle.swf"',
		' pluginspage="http://www.macromedia.com/go/getflashplayer"',
		' id="djuiceLeadSWF" name="djuiceLeadSWF" bgcolor="#ffffff" align="left"',
		' quality="high" wmode="transparent" salign="lt" allowscriptaccess="always" flashvars="t_visual=',
		 t_visual.replace(/"/g,''),
		'&amp;t_id=djuiceLead&amp;t_title=',$('div#djuiceLead h1').html(),
		'&amp;t_lead=',$('div#djuiceLead p').html(),
		'" height="',
		$('div#djuiceLead')[0].offsetHeight,'" width="',$('div#djuiceLead')[0].offsetWidth,'" />'].join(''));
	
	}
*/

	function fixIEselectBug() {
		try{ 
			noIEscrollFIX;
		}catch(e){ 
			noIEscrollFIX = false; 
		}
		if(!noIEscrollFIX)
			document.body.style.height = document.documentElement.scrollHeight + 'px';
	}
	
	function GAEvents() {
		
		var PageTitle = document.title.replace(" - djuice", "");
		
		if ( PageTitle == "" || PageTitle == "djuice.hu" ) {
			PageTitle = "Nyitó oldal / Nincs oldal cím";
		}
		
		// Djuice Join button a fejlecben
		$("#Head div.func a.button4").click(function() {
			pageTracker._trackEvent('Djuice join', PageTitle);
		});
		
		// Kereses gombok
		$("#ADF_Submit #search_btn").click(function() {
			pageTracker._trackEvent('Készülékkereső', PageTitle);
		});
		
		// Nyito oldal - osszes kereso
		if ( PageTitle == "Nyitó oldal / Nincs oldal cím" ) {
			$("#ADF_Submit #reset_btn").click(function() {
				pageTracker._trackEvent('Készülékkereső', 'Főoldal - Összes készülék gomb');
			});
		}
		
		// Nyito oldal - promok
		$("#promoimg0 a").click(function() {
			var aHref = $(this).find("img").attr("src");
			aHref = aHref.replace(/http:\/\/[^\/]+/i, "");
			pageTracker._trackEvent('Főoldali promo', 'Elsődleges', aHref);
		});
		
		$("#promoimg1 a, #promoimg2 a, #promoimg3 a").click(function() {
			var aHref = $(this).find("img").attr("src");
			aHref = aHref.replace(/http:\/\/[^\/]+/i, "");
			pageTracker._trackEvent('Főoldali promo', 'Másodlagos', aHref);
		});
		
		if ( PageTitle == "Netshop" ) {
			$("#Cont div.productlist a").click(function() {
				pageTracker._trackEvent('Netshop oldal', $(this).closest("div.item").find("h3 a").text() + ' végoldalra');
			});
			
			$("#Cont table a").click(function() {
				pageTracker._trackEvent('Netshop oldal', $(this).text() + ' - link');
			});
		}
		
	}
	
	function promobanner() {
		
		// Video banner
		var so = new SWFObject("swf/djuice_online_tutorial_onsite_v1.swf", "videobannerembed", "225", "184", "9", "#ffffff");
		so.addVariable("video_path0", "videobanner/djuice_5percutan_intro.flv"); 
		so.addVariable("video_path1", "videobanner/djuice_folks_intro.flv"); 
		so.addVariable("video_path2", "videobanner/djuice_mixer_intro.flv"); 
		so.addVariable("video_path3", "videobanner/djuice_mobilemail_intro.flv"); 
		so.addVariable("video_path4", "videobanner/djuice_reloadnet_intro.flv"); 
		so.addVariable("video_path5", "videobanner/djuice_complete_intro.flv");
		
		so.addVariable("url_path5", "http://www.djuice.hu/kedvezmenyek/5-perc-utan/");
		so.addVariable("url_path1", "http://www.djuice.hu/kedvezmenyek/folks/"); 
		so.addVariable("url_path2", "http://www.djuice.hu/tarifak/mixer/mixer/");
		so.addVariable("url_path3", "http://www.djuice.hu/szolgaltatasaink/mobilemail/"); 
		so.addVariable("url_path4", "http://www.djuice.hu/internet/akciok/feltoltokartyas-mobilinternet/"); 
		so.addVariable("url_path0", "http://www.djuice.hu/tarifak/szamlas-tarifacsomagok/complete/");
		
		if ( $("#left_videobanner_5perc").length ) {
			so.addVariable("fixed_start", "true");
			so.write("left_videobanner_5perc");
		} else if ( $("#left_videobanner").length ) {
			so.write("left_videobanner");
		}
		
		// Demo swf
		//Folks
		if ($("#bigdemoplayer_folks").length ) {
			var so = new SWFObject("swf/djuice_tutorials.swf", "demo_folks", "617", "559", "9", "#ffffff");
			so.addParam("wmode", "transparent");
			so.addVariable("presentation_name", "djuice_folks");
			so.write("bigdemoplayer_folks");
		}
		
		//Mobilemail
		if ($("#bigdemoplayer_mobilemail").length ) {
			var so = new SWFObject("swf/djuice_tutorials.swf", "djuice_mobilemail", "617", "559", "9", "#ffffff");
			so.addParam("wmode", "transparent");
			so.addVariable("presentation_name", "djuice_mobilemail");
			so.write("bigdemoplayer_mobilemail");
		}
		
		//Mixer
		if ($("#bigdemoplayer_mixer").length ) {
			var so = new SWFObject("swf/djuice_tutorials.swf", "djuice_mixer", "617", "559", "9", "#ffffff");
			so.addParam("wmode", "transparent");
			so.addVariable("presentation_name", "djuice_mixer");
			so.write("bigdemoplayer_mixer");
		}
		
		//Reloadnet
		if ($("#bigdemoplayer_reloadnet").length ) {
			var so = new SWFObject("swf/djuice_tutorials.swf", "djuice_reloadnet", "617", "559", "9", "#ffffff");
			so.addParam("wmode", "transparent");
			so.addVariable("presentation_name", "djuice_reloadnet");
			so.write("bigdemoplayer_reloadnet");
		}
		
		
		//Complete
		if ($("#bigdemoplayer_complete").length ) {
			var so = new SWFObject("swf/djuice_tutorials.swf", "djuice_complete", "617", "559", "9", "#ffffff");
			so.addParam("wmode", "transparent");
			so.addVariable("presentation_name", "djuice_complete");
			so.write("bigdemoplayer_complete");
		}
		
	}
	
	//$(document).ready(function(){ Site.init(); });

	/*
	 * 	public
	 */
	
	return {
		noflash: noflash,
		init: function() {
			try {GAEvents();} catch(e) {}
			
			if (IE6) {try {menuHover();} catch(e) {}}
			if (document.body.className.indexOf('index') >= 0) {try {promorotator();} catch(e) {}}
			try {embedFont();} catch(e) {}
			try {tabsheet();} catch(e) {}
			try {promobanner();} catch(e) {}

//			try{ clearButtons(); }catch(e){}
//			try{ initLead(); }catch(e){}
			
//			try{ Site.Sales.lead(); }catch(e){}
			try{ Site.Sales.packages(); }catch(e){}
			
//			try{ Site.Services.lead(); }catch(e){}
	
//			try{ Site.Device.tabs(); }catch(e){}
			try{ Site.Device.device(); }catch(e){}
//			try{ Site.Device.features(); }catch(e){}
//			try{ Site.Device.searchBox(); }catch(e){}
			
			
//			try{ Site.Promos.junePromo(); }catch(e){}
			
//			try{ leadServices(); }catch(e){}
			
/*
	if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7) {
				menu('ul#Navigation li');
				//correctPNG();
				fixIEselectBug();
			}
*/			
			
			
		},
		setLead: function(_id, _height){
			$('#'+_id+', #'+_id+' embed').css({height: parseInt(_height,10)});
		},
		newWindow: function(nev, w, h, scroll, _imagepopup ) {
			
			sc = arguments[3] || 1;
		
			var str='scrollbars='+sc+',width='+w+',height='+h+',left='+((screen.width/2)-(w/2))+',top='+((screen.height/2)-(h/2));
			var nyit = (_imagepopup)?window.open('', 'tartalom', str):window.open(nev, 'tartalom', str);
			
			if (_imagepopup)
			{
			
				_base = document.getElementsByTagName('base');
				_baseHref = _base[0].getAttribute('href');
				_newBody = nyit.document.getElementsByTagName('body');
				_newBody[0].style.margin = '0px';
				_newBody[0].style.padding = '0px';	
				if(!document.agent.ie)
				{
					nev = _baseHref.substr(0, _baseHref.length-1)+nev;
				}
				_newBody[0].innerHTML = '<img src="'+nev+'" width="'+w+'" height="'+h+'" alt="" />';
			}
			nyit.focus();
		}	
	};
}();


/*
Site.Services = {
	lead: function(){
		$('div#djuiceLeadServices h2')[0].innerHTML = [
		'<embed src="swf/flekk.swf" quality="high"',
		' scale="noscale" salign="lt" wmode="transparent"',
		' bgcolor="#ffffff" width="326" height="64" name="" id="" align="left" allowScriptAccess="sameDomain"',
		' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"',
		' flashvars="t_lead=',
		$.trim($('div#djuiceLeadServices h2 a').html()),
		'&amp;t_url=',
		$('div#djuiceLeadServices h2 a')[0].href,
		'" />'].join("");
	}
}
*/

/*
Site.Promos = {
	index: function(_lang){
		if(  Site.noflash )return false;
				 		
		var _links = new Array();
		$('div#IndexDjuicePromo h1 a').each(function(i,s){ _links.push(s.href) });
		_links = _links.join(',');
	
		var _images = new Array();
		var _titles = new Array();
		$('div#IndexDjuicePromo img').each(function(i,s){ _images.push(s.src); _titles.push(s.alt); });
		_images = _images.join(',');
		_titles = _titles.join(',');		
		
		var so = new SWFObject("swf/main_promo.swf", "djuiceMainPromoSWF",  600, 282, "8", "#ffffff");
		so.addParam("quality", "high");
		so.addParam("wmode", "transparent");
		so.addParam("salign", "lt");
		so.addParam("AllowScriptAccess","always");

		so.addVariable("images",_images); 
		so.addVariable("titles",_titles); 
		so.addVariable("links",_links);
				
		so.write("IndexDjuicePromo");
	},
	indexDevices: function(_xml){
		var so = new SWFObject("swf/Djuice_keszulek_kereso_v5.swf", "djuiceDevicePromoSWF",  284, 298, "8", "#ffffff");
			so.addParam("quality", "high");
			so.addParam("wmode", "transparent");
			so.addParam("salign", "lt");
			so.addParam("AllowScriptAccess","always");
			so.addVariable("xmlPath", _xml);
			
			so.write("IndexDevicePromo");
	},
	junePromo: function() {
			var so = new SWFObject("swf/djuice_june_roskilde.swf", "djuicepromojune",  920, 600, "8", "#ffffff");
			so.addParam("quality", "high");
			so.addParam("wmode", "transparent");
			so.addParam("salign", "lt");
			so.addParam("AllowScriptAccess","always");
			so.write("djuiceJunePromo");			
	},
	indexCircus: function(){
		
		if(  !Site.noflash ) {
			$('div#CircusMainFlash').removeClass('circusnoflash');
			
		}
		
		var so = new SWFObject("swf/circus.swf", "djuiceCircusSWF",  920, 660, "8", "#000000");
			so.addParam("quality", "high");
			so.addParam("wmode", "transparent");
			so.addParam("salign", "lt");
			so.addParam("AllowScriptAccess","always");			
			so.write("CircusMainFlash");
	}	
};
*/


Site.Sales = {
/*
  lead: function(){

		if(  Site.noflash )return false;	
		
		
			
		_a = new Array();
		
		$('div#djuiceLeadSales ul li').each(function(i,s){ _a.push($.trim($(s).html()) )  })
		
		$('div#djuiceLeadSales')[0].innerHTML = [
		'<embed src="swf/akciok_promo.swf" quality="high"',
		' scale="noscale" salign="lt" wmode="transparent"',
		' bgcolor="#ffffff" width="662" height="316" name="" id="" align="left" allowScriptAccess="sameDomain"',
		' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"',
		' flashvars="t_title=',
		$('div#djuiceLeadSales h1').html(),
		'&amp;t_devmanufacturer=',
		$('div#djuiceLeadSales h2 a span.dev_m').html(),
		'&amp;t_devmodell=',
		$('div#djuiceLeadSales h2 a span.dev_t').html(),
		'&amp;t_pricepackage=',
		$('div#djuiceLeadSales h2 a span.pri_p').html(),
		'&amp;t_pricevalue=',
		$('div#djuiceLeadSales h2 a span.pri_v').html(),
		'&amp;t_acronyms=',
		_a.join(','),
		'&amp;t_detailstext=',
		$('div#djuiceLeadSales a.details').html(),
		'&amp;t_detailslink=',
		$('div#djuiceLeadSales a.details').attr('href'),
		'&amp;png_device=',
		$('div#djuiceLeadSales img').attr('src'),
		'" />'].join("");			
	},
*/
	packages: function(){
		$('div#packageselector ul li a').click(function(event) {
			event.stopPropagation();
			this.blur();
			$('div#productlist')[0].className = 'productlist ' + this.parentNode.className;
			return false;
		});			
	}
};


Site.Device = {
	
/*
	tabs: function(){
//		$('div#deviceData').css('paddingBottom',$('table#devicePrices')[0].offsetHeight+20);		
		$('div#deviceData dl dt').each(function(i,s){
			if(!$(s).hasClass('on')){
				$('div#deviceData dl dd.'+s.className).hide();
			}
		}).click(function(){
			$('div#deviceData dl dt.on').removeClass('on');
			$('div#deviceData dl dd').hide();
			$('div#deviceData dl dd.'+this.className).show();
			$(this).addClass('on');
		});
	},
*/
	device: function(){
		if( Site.noflash )return false;
			
		if ((phoneImages != undefined) && (String(phoneImages.split(',')).length <= 1)) {
			$('div#deviceVisual').css({height: 300});
		}
		$('div#deviceVisual')[0].innerHTML = [
		'<embed src="swf/device_gallery_mini.swf" quality="high"',
		' scale="noscale" salign="lt" wmode="transparent"',
		' bgcolor="#ffffff" width="260" height="390" name="" id="" align="left" allowScriptAccess="sameDomain"',
		' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"',
		' flashvars="t_devmanufacturer=',
		$('div#deviceVisual h1 span.dev_m').html(),
		'&amp;t_devmodell=',
		$('div#deviceVisual h1 span.dev_t').html(),
		'&amp;png_device=',
		(phoneImages.split(',').length < 1)?$('div#deviceVisual img').attr('src'):phoneImages,
		'&amp;t_id=deviceVisual',
		'" />'].join("");				
	}/*,
	
	features: function(){
		if( Site.noflash )return false;
		
		_a = new Array();
		
		$('ul#FeatureIcons li').each(function(i,s){ _a.push($(s).html())  })		
				
		$('ul#FeatureIcons')[0].innerHTML = [
		'<embed src="swf/keszulek_features.swf" quality="high"',
		' scale="noscale" salign="lt" wmode="transparent"',
		' bgcolor="#ffffff" width="380" height="27" name="" id="" align="left" allowScriptAccess="sameDomain"',
		' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"',
		' flashvars="t_acronyms=',
		_a.join(','),
		'" />'].join("");			
		
	},
	
	searchBox: function(){
		$('div#DeviceSearch div#priceRange').slider( { 
			minValue: parseInt($('div#DeviceSearch .price_min').html().replace(" ",""),10), 
			maxValue: parseInt($('div#DeviceSearch .price_max').html().replace(" ",""),10), 
			range: true, 
			change: function(e,ui){ Site.Device.searchBoxRefreshSlider( true,ui); },
			slide: function(e,ui){ Site.Device.searchBoxRefreshSlider( true,ui); }
		} );
	},
	searchBoxRefreshSlider: function( _dual, _value ){
		if(typeof _value == 'object'){
			if(_dual){
				_values = [Math.round(($(_value.handle[0].parentNode.parentNode).slider("value",0)) / 100)*100,Math.round(($(_value.handle[0].parentNode.parentNode).slider("value",1))/100)*100]
			} else {
				_values = Math.round(_value.value);
			}
		} else {
			_values = Math.round(_value);
		}



		if(_dual){
			$('div#DeviceSearch .price_min').html(_values[0].toString().reverse().replace(/(\d{3})/g, "$1 ").reverse().replace(/^(-)?,/, "$1")+' '+LANG_FORINT);
			$('div#DeviceSearch .price_max').html(_values[1].toString().reverse().replace(/(\d{3})/g, "$1 ").reverse().replace(/^(-)?,/, "$1")+' '+LANG_FORINT);
			
			$('input[name=numPriceMax]').val(parseInt(_values[1],10));							
			$('input[name=numPriceMin]').val(parseInt(_values[0],10));
		} 	
		
		
	}				
*/	
};

/*
var Tooltip = function(){
	return {
		timer: 0,
		offset: 0,
		init: function( _offset ){
			
			this.offset = _offset || 0;
			
			var noHeight = arguments[1] || false;
			
			$('div#Center').prepend( ['<div id="ToolTip"',(noHeight)?' class="noheight"':'','><span></span> <div ></div>'].join('') );
			$('div#ToolTip').mouseout(function(e){
				Tooltip.hide();
				$(e).stopEvent();
			});
			this.hide();
			this.setup();
			
		},
		setup: function(){			
			
			$('ul#DeviceSearchResults li')
				.mouseover(function(e){
					if (!$(this).hasClass('detailed')) {
						$(this).addClass('hover');
						
						_t = $(this).position().top + Tooltip.offset;
						_r = 674 - $(this).position().left;
						$('div#ToolTip').html(
							[
								'<strong>', $(this).find('strong').html(), '</strong>', 
								(  $(this).find('strong').html().length < 34  )?'<p>'+$(this).find('p').html()+'</p>':'',								
								'<span>', (ADF.priceType != 'none')?$(this).find('span.' + ADF.priceType).html():$(this).find('span.price').eq(0).html(), '</span>'
							].join(''))
						.css({
							top: _t,
							right: _r
						});
						
						Tooltip.timer = later(Tooltip, 500, 'show');
					}
					$(e).stopEvent();
				}).mouseout(function(e){
					
					clearTimeout(Tooltip.timer);
					Tooltip.hide();
					$(this).removeClass('hover');
					$(e).stopEvent();
				});
		},
		hide: function(){
			$('div#ToolTip').hide().css({ marginRight: -13, width: 0});
		},
		show: function(e, _content){
			clearTimeout(this.timer);			
			$('div#ToolTip').show().animate({marginRight: 0,width: 168},'fast');
		}
	};
}();
*/

if (IE6) {
	var IEPNG = function(){
		
		window.attachEvent('onload', function(){
			IEPNG.fix();
		});

		
		return {
			fix: function(){
				for(var i=0; i<document.images.length; i++)	{
					var img = document.images[i]
					var imgName = img.src.toUpperCase();
					if (imgName.substring(imgName.length-3, imgName.length) == "PNG" && !img.pngFixed) {
						img.pngFixed = true;
						var imgBg = img.src;
						img.src = "/i/none.gif";						
						img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + imgBg + "\', sizingMethod='scale');"
						i = i-1;		
					}
				}
			}
		}
		
	}();
}



$(document).ready(function() {
	Site.init();

});



