// JavaScript Document

function makeLayer(name,ext,x,y,z,border,popup,url,text,k,l,xx,yy) {
	//creates the layer
	
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id','lr-'+name);
	newdiv.style.left = x+"px";
	newdiv.style.top = y+"px";
	newdiv.style.position = "absolute";
	//if(border== '1' ){ newdiv.style.border= "1px solid #333333"; }
	newdiv.style.zIndex = z;
	if(popup == '1'){
	newdiv.onmouseover = function() {showhide('lr-10'+name,1);}
	newdiv.onmouseout = function() {showhide('lr-10'+name,0);}
	}
	//creates image
	var newa = document.createElement('a');
	var newimg = document.createElement('img');	

	var kati = newdiv.appendChild(newa);
	var eikona = kati.appendChild(newimg);
	if(ext== 'jpg' || ext== 'png' ){ eikona.src = "thumb/thumb"+name+"."+ext; }
	if(ext== 'gif' ){	eikona.src = "anim/anim"+name+"."+ext; }
	
	if(text!=''){
	if(popup == '1'){
		var innerdiv = document.createElement('div');
		var innera = document.createElement('a');
		
		innerdiv.setAttribute('id','lr-10'+name);
		innerdiv.setAttribute("class", "arttitles2");
		innerdiv.setAttribute("className", "arttitles2");
		innerdiv.style.position = "absolute";
		innerdiv.style.right = Number(k)+"px";
		innerdiv.style.bottom = Number(l)+"px";
		innerdiv.style.zIndex = '32';
		innerdiv.style.visibility = 'hidden';
		
		innera.style.backgroundColor = "#caf3e5";
		innera.style.textDecoration = "none";
		innera.style.color = "#333333";
		innera.href = "../"+url;
		innera.target = "_self";
		innera.innerHTML = text;
		innerdiv.appendChild(innera);
		newdiv.appendChild(innerdiv);
	}
	if(popup == '2' || popup == ''){
		var spasm = url.split(".");
		if(spasm[1] == "swf"){
			kati.ondblclick = function() {return hs.htmlExpand(this, { src: [url], objectType: 'swf', width: [k], objectWidth: [k],                                          objectHeight: [l], maincontentText: 'You need to upgrade your Flash player',                                          wrapperClassName: 'draggable-header no-footer no-controls' } );}
		}else{
			if(popup == ''){
				if(ext== 'jpg' || ext== 'png' ){ url = "thumb/thumb"+name+"."+ext; }
				if(ext== 'gif' ){	url = "anim/anim"+name+"."+ext; }
			}
			kati.ondblclick = function() {return hs.expand(this, { src: [url] });}
			
		}
		kati.setAttribute('class', 'highslide');
		kati.setAttribute('className', 'highslide');
		kati.setAttribute('rel', 'highslide');
		eikona.setAttribute("title", "Drag to move, Double click to enlarge");
		//creates legend 
		var leg = document.createElement('div');
		var legend = newdiv.appendChild(leg);
		legend.setAttribute("class", "highslide-caption");
		legend.setAttribute("className", "highslide-caption");
		var newa = document.createElement('a');
		var newb = legend.appendChild(newa);
		var newc = document.createElement('span');
		newc.setAttribute("class", "arttitles2");
		newc.setAttribute("className", "arttitles2");
		newc.innerHTML = text;
		newb.appendChild(newc);	
	}
	}
	document.body.appendChild(newdiv);
}
function changeLink(id,keimeno)
{
id.innerHTML=keimeno;
}

function increaseDecrease(state,thenode){
	var cssRules;
	if (document.all) {
		cssRules = 'rules';
	}
	else if (document.getElementById) {
	  	cssRules = 'cssRules';
	}

	var theobj = thenode.parentNode.parentNode;
	//var theobjtitle = document.getElementById("title")
	
	var change = 1;
	if(state==2){
		change=-change;
	}
	
	if(!theobj.style.fontSize){
		for (var R = 0; R < document.styleSheets[1][cssRules].length; R++) {
			if(document.styleSheets[1][cssRules][R].selectorText == "."+theobj.className){
				if((parseInt(document.styleSheets[1][cssRules][R].style.fontSize)+change<17) && (parseInt(document.styleSheets[1][cssRules][R].style.fontSize)+change>10)){
					
				theobj.style.fontSize = parseInt(document.styleSheets[1][cssRules][R].style.fontSize)+change+"px";
				theobj.style.lineHeight = parseInt(document.styleSheets[1][cssRules][R].style.lineHeight)+change+"px";
				theobj.style.letterSpacing = parseFloat(document.styleSheets[1][cssRules][R].style.letterSpacing)+change/10+"px";
				//theobjtitle.style.fontSize = parseInt(theobj.style.fontSize)+4+"px";
				}
			}
		}
	}else{
		if((parseInt(theobj.style.fontSize) +change<17) && (parseInt(theobj.style.fontSize) +change>10)){
			
		theobj.style.fontSize = parseInt(theobj.style.fontSize) +change+"px" ;
		theobj.style.lineHeight = parseInt(theobj.style.lineHeight)+change+"px";
		theobj.style.letterSpacing = parseFloat(theobj.style.letterSpacing)+change/10+"px";	
		//theobjtitle.style.fontSize = parseInt(theobj.style.fontSize)+4+"px";
		}
	}			
}
