function rozbal(strURL, divID) {
    var xmlHttpReq = false;
    //var self = this;
    //strURL = 'http://www.levhart.cz/cdh-beta/';
    //strURL.replace("&", "&amp;");
    //alert('Request URL: ' + strURL);
    // Mozilla/Safari

    if (window.XMLHttpRequest) {
        xmlHttpReq = new XMLHttpRequest();

    }
   // IE
    
   else if (window.ActiveXObject) {
        xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }


    xmlHttpReq.open('POST', strURL, true);
    xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    xmlHttpReq.onreadystatechange = function() {
        if (xmlHttpReq.readyState == 4) {
	   //alert("loading data");
            updatePopisek(xmlHttpReq.responseText, divID);
        }
    }
    xmlHttpReq.send(null);
}

function updatePopisek(str, divID){
    //if (document.getElementById(divID).innerHTML =="")
    //alert(divID);
    document.getElementById(divID).innerHTML = str;
    //else document.getElementById(divID).innerHTML = "";
}



var id = 2;
function pridejMoznost(tabulka, inputName, popisek, type) { 	

	if (id > 5) return;
	var table = document.getElementById(tabulka); 
	var rowCount = table.rows.length;	
			
	var input = document.createElement('input'); 
	input.type = type; 
	input.setAttribute('name', '' + inputName + id ); 

	var text = document.createTextNode('' + popisek + id + ': ');
	 
	var row = table.insertRow(rowCount - 1);
	var cell_1 = row.insertCell(0);
	cell_1.appendChild(text);

	var cell_2 = row.insertCell(1);
	cell_2.appendChild(input);
	
	if (tabulka == "pridat-galerii"){
		
		var select = document.createElement('select');
		select.setAttribute('name', 'typ' + id ); 
		
		var option1 = document.createElement('option');		
		option1.setAttribute('value', 'screenshot');		
		text = document.createTextNode('Screen-shot');		
		option1.appendChild(text);		
		
		var option2 = document.createElement('option');		
		option2.setAttribute('value', 'artwork');		
		text = document.createTextNode('ArtWork');		
		option2.appendChild(text);
		
		var option3 = document.createElement('option');		
		option3.setAttribute('value', 'neurceno');		
		text = document.createTextNode('Neurčeno');		
		option3.appendChild(text);
		
		select.appendChild(option3);
		select.appendChild(option2);
		select.appendChild(option1);
		
		var cell_3 = row.insertCell(2);
		cell_3.appendChild(select);
		
	}
			 
    id++; 
 }  

//Diskuze
function swap_posticon(imgid)
{	
	var out = document.images['posticon'];		
	var img = document.images[imgid];
	if (img)
	{
		out.src = img.src;
		out.alt = img.alt;
	}
	else
	{
		out.src = "clear.gif";
		out.alt = "";
	}
}



function paste_strinL(startTag, endTag, form, area) {
    var myField=document.forms[form].elements[area];
    
 //IE support
 if (document.selection) {
     myField.focus();
     sel = document.selection.createRange();
     sel.text = startTag+sel.text+endTag;
     myField.focus();
 }
 //MOZILLA/NETSCAPE support
 else if (myField.selectionStart || myField.selectionStart == '0') {
     var startPos = myField.selectionStart;
     var endPos = myField.selectionEnd;
     myField.value = myField.value.substring(0, startPos)
                   + startTag
                   + myField.value.substring(startPos, endPos)
                   + endTag
                   + myField.value.substring(endPos, myField.value.length);
     myField.focus();
     myField.selectionStart = startPos + startTag.length;
     myField.selectionEnd = endPos + startTag.length;
 } else {
     myField.value += myValue;
     myField.focus();
 }
 
}

