var v = navigator.userAgent;
var isIE  = (v.indexOf("MSIE 4") != -1 || v.indexOf("MSIE 5") != -1 || v.indexOf("MSIE 6") != -1);
var isNS4 = (!isIE && v.indexOf("Mozilla/4") != -1);
var isNS6 = document.getElementById&&!document.all;
var isOpera  = (v.indexOf("Opera") != -1);

var KalkStatus = 0;
var MellStatus = 0;
var xtop=0;
var xleft=0; 
// pixel = new Image();
// pixel.src = "/stat/pixel.tdp?x="+screen.width+"&y="+screen.height;                       

function winopen(url) {
	window.open(url);
}

function openWin(url,w,h,c)
{
	if(c)
	{
		xtop  = ((screen.availHeight-h)/2)-80;
		xleft = ((screen.availWidth-w)/2);
	} else {
		xtop  = 5;
		xleft = 5;
	}
	parem='status=0,menubar=0,resizable=1,copyhistory=no,directories=no,scrollbars=1,width='+w+',height='+h+',top='+xtop+',left='+xleft+'';
	var ywin = window.open(url, "c556zxy", parem);
	ywin.focus();
}

function openImageWin(url,w,h)
{
	var ztop  = ((screen.availHeight-h)/2)-80;
	var zleft = ((screen.availWidth-w)/2);
	parem='status=0,menubar=0,resizable=1,copyhistory=no,directories=no,scrollbars=1,width='+w+',height='+h+',top='+ztop+',left='+zleft+'';
	window2=window.open('','window2',parem);
	window2.document.open("text/html","replace");
	window2.document.writeln("<html><head><title>Portfolio.hu</title></head><body bgcolor=white style='margin:0 0 0 0'>");
	window2.document.writeln("<a href='javascript:self.close()'><img src="+url+" width="+w+" height="+h+" border=0></a>");
	window2.document.writeln("</body></html>");
	window2.document.close();
	window2.focus();
}
function def1(th) {
	
	if(th.value==th.defaultValue) {th.value='';}
}
function def2(th) {
	if(th.value=='') {th.value=th.defaultValue;}
}

/*----- font meret allitgatas -------------*/
	var expDays = 30;
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	
	function SetFontSizeCookie(cookiename,value)
	{
		var argv = SetFontSizeCookie.arguments;  
		var argc = SetFontSizeCookie.arguments.length;  	
		var expires = (argc > 2) ? argv[2] : null;  
		var path = "/";
		document.cookie = cookiename + "=" + escape (value) + ";expires=" + expires.toGMTString() + ";path=" + path;		
	}
	
	function getFontSizeCookieVal (offset) 
	{  
		var endstr = document.cookie.indexOf (";", offset);  
		if (endstr == -1)    
		endstr = document.cookie.length;  
		return unescape(document.cookie.substring(offset, endstr));
	}
	
	function GetFontSizeCookie(cookiename) 
	{  
		var arg = cookiename + "=";  var alength = arg.length;  var clength = document.cookie.length;  
		var i = 0;  
		while (i < clength) 
		{    
			var j = i + alength;    
			if (document.cookie.substring(i, j) == arg) return getFontSizeCookieVal(j);    
			i = document.cookie.indexOf(" ", i) + 1;    
			if (i == 0) break;   
		}
		return null;
	}

	function sizethis(x,ln) 
	{
		var def = document.getElementById("cikk").style.fontSize;
		var val = Number(def.substring(0,(def.length)-2));
		switch (x)
		{
			case '1':
			if(val >= 15) val=15;
			var meret = Number(val + 1);
			break;
				
			case '0':
			if(val <= 10) val=10;
			var meret = Number(val - 1);
			break;
		}	
		document.getElementById("cikk").style.fontSize = meret +'pt'; 
		SetFontSizeCookie('portfoliocikkfont',meret,exp);
		make_links(meret,ln);
	}
	function make_links(m,ln) 
	{
		var cucc='';
		switch (ln)
		{
			case 'en':
				var t = 'font size: ';var szo1 = 'decrease'; var szo2 = 'increase';
			break;
			case 'hu':
				var t = 'betűméret: '; var szo1 = 'csökkent'; var szo2 = 'növel';
			break;
			default:
				var t = 'betűméret: '; var szo1 = 'csökkent'; var szo2 = 'növel';
			break;
		}
		switch (true)
		{
			case (m <= 10):
				cucc = t + '<a href="javascript:sizethis(\'1\',\''+ln+'\')">'+szo2+'</a> | '+szo1;
			break;				
			case (m >= 15):
				cucc = t +szo2+' | <a href="javascript:sizethis(\'0\',\''+ln+'\')">'+szo1+'</a>';
			break;
			default:
				cucc = t + '<a href="javascript:sizethis(\'1\',\''+ln+'\')">'+szo2+'</a> | <a href="javascript:sizethis(\'0\',\''+ln+'\')">'+szo1+'</a>';
			break;
		}
		document.getElementById("slink").innerHTML = cucc;
	}
	


function showFlash(swf,alt,size,url,bgcolor,window)
{
	// classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" type="application/x-shockwave-flash"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=3,0,0,0" id=top '+size+'>\n');
	document.write('<param name="movie" value="'+swf+'"><param name="quality" value="high">\n');
	if(bgcolor!='') document.write('<param name="bgcolor" value="'+bgcolor+'">');
	if(window!='') document.write('<param name="window" value="'+window+'">');
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin && navigator.plugins && navigator.plugins["Shockwave Flash"]) {
		document.write('<embed src="'+swf+'" quality=high');
		document.write(' swLiveConnect="false" '+size+'');
		if(bgcolor!='') document.write(' bgcolor="'+bgcolor+'" ');
		if(bgcolor!='') document.write(' window="'+window+'" ');
		document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');
	} else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
		if(url!='') document.write('<a href="'+url+'">');
		document.write('<img src="'+alt+'" '+size+' border="0" alt="">');
		if(url!='') document.write('</a>');
	}
	document.write('</object>');
}
function flash(swf,size,altimg,url,bgcolor)
{
	var isalt = (altimg != "" && typeof(altimg) != "undefined") ? 1 : 0;
	var isurl = (url != "" && typeof(url) != "undefined") ? 1 :  0;
	var tsize = (size != "" && typeof(size) != "undefined") ? size : "40x40";
	var s   = tsize.split("x");
	var out = '<object width="' + s[0] + '" height="' + s[1] + '" ';
	var IE  = 0;
	var agent = navigator.userAgent.toLowerCase();
	if(agent.indexOf("msie") != -1) IE = 1;
	if(IE) {
		out += 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">\n'+
		'<param name="movie" value="' + swf + '">\n';
	} else {
		out += 'data="' + swf + '" type="application/x-shockwave-flash">\n';				
	}
	out += '<param name="quality" value="high">\n';
	if(bgcolor!='' && typeof(bgcolor) != "undefined") {
		out += '<param name="bgcolor" value="' + bgcolor + '">\n';
	}
	if(isalt) {
		if(isurl) {out += '<a href="' + url + '">';}
		out += '<img src="' + altimg + '" width="' + s[0] + '" height="' + s[1] + '" border="0">';
		if(isurl) {out += '</a>\n';}
	} else {
		out += '<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">';
	}
	out+='<param name="menu" value="false"></object>\n';
	document.write(out);
}
function getElementbyClass(classname)
{
	var inc=0;
	var customcollection = new Array;
	var alltags=document.all? document.all : document.getElementsByTagName("*");
	for (i=0; i<alltags.length; i++)
	{
		if (alltags[i].className==classname)
			customcollection[inc++]=alltags[i];
	}
	return customcollection;
} 
