function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


function unHide(param){
  var x=document.getElementsByName("formos");
//  alert(x.length);
  for(i=0; i<x.length; i++){
   x[i].style.display='none';
  }
  var x=document.getElementsByName("select");

 for(i=0; i<x.length; i++){
   x[i].value='form_0';
  }
 document.getElementById(param).style.display='block';
}

function unHideFormos(param){
  var x=document.getElementsByName(param);
  
  for(i=0; i<x.length; i++){
   x[i].style.display='none';
  }
    var y=document.getElementsByName("formos");
 for(a=0; a<y.length; a++){
   y[a].style.display='none';
  }
}

function cr_form(param){
		var x=document.getElementsByName("formos11");
		for(i=0; i<x.length; i++){
		x[i].style.display='none';	
		}
		for(a=param; a<x.length; a++){
		x[a].style.display='block';
  		}	
	
}
function formaction(cid){
	var x=document.getElementsByName("formos");
  
  for(i=0; i<x.length; i++){

   		//x[i].action='index.php?cid'+cid;
		
		var nnm = x[i].attributes;
		var namedItem = document.createAttribute("action");
		namedItem.value = 'index.php?cid='+cid;
		nnm.setNamedItem(namedItem);
  }
}
function inp_val(param){
  var x=document.getElementsByName('duk2_id');
  
  for(i=0; i<x.length; i++){
   x[i].value=param;
  }
}
function email_link(inp){
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + //all caps
"abcdefghijklmnopqrstuvwxyz" + //all lowercase
"0123456789+/="; // all numbers plus +/=
  	var out = ""; //This is the output
	var chr1, chr2, chr3 = ""; //These are the 3 decoded bytes
	var enc1, enc2, enc3, enc4 = ""; //These are the 4 bytes to be decoded
	var i = 0; //Position counter

	// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
	var base64test = /[^A-Za-z0-9+/=]/g;

	if (base64test.exec(inp)) { //Do some error checking
		alert("There were invalid base64 characters in the input text.n" +
		"Valid base64 characters are A-Z, a-z, 0-9, ?+?, ?/?, and ?=?n" +
		"Expect errors in decoding.");
	}
	inp = inp.replace(/[^A-Za-z0-9+/=]/g, "");

	do { //Here.s the decode loop.

		//Grab 4 bytes of encoded content.
		enc1 = keyStr.indexOf(inp.charAt(i++));
		enc2 = keyStr.indexOf(inp.charAt(i++));
		enc3 = keyStr.indexOf(inp.charAt(i++));
		enc4 = keyStr.indexOf(inp.charAt(i++));

		//Heres the decode part. There.s really only one way to do it.
		chr1 = (enc1 << 2) | (enc2 >> 4);
		chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
		chr3 = ((enc3 & 3) << 6) | enc4;

		//Start to output decoded content
		out = out + String.fromCharCode(chr1);

		if (enc3 != 64) {
			out = out + String.fromCharCode(chr2);
		}
		if (enc4 != 64) {
			out = out + String.fromCharCode(chr3);
		}

		chr1 = chr2 = chr3 = "";
		enc1 = enc2 = enc3 = enc4 = "";

	} while (i < inp.length); 


  top.location.href='mailto:'+out;
}
function rel(param,name, url){
 top.location.href='index.php?cid='+param+'&'+name+'='+url;
}
function getListboxText(id,m,cid){
    var str=new String('');
    for(var i=0; i<document.getElementById(id).options.length; i++){
        if(document.getElementById(id).options[i].selected) var str=document.getElementById(id).options[i].text;
    }
 top.location.href='index.php?cid='+cid+'&month='+m+'&year='+str+'&forma='+id;
}
function setSelectOption(id,year){
    var str=new String('');
	//alert(document.getElementById(id).options.length);
	for(var i=0; i<document.getElementById(id).options.length; i++){
        if(document.getElementById(id).options[i].text==year){
			document.getElementById(id).options[i].setAttribute( "selected",true );//MS IE 7
			document.getElementById(id).options[i].selected=true; //firefox, opera

			//alert(document.getElementById(id).options[i].selected);
		}    
	}
}
function SetValue(id, value){
	document.getElementById(id).value = value;	
}
function SetDisplay(id, value){
	document.getElementById(id).style.display = value;	
}
function resizeW(forma){

}