// JavaScript Document

function getWork(id, start){
	location.href = '?work='+id+'&start='+start;
}

function logIn(){
	OpenAjaxPostCmd('verify.php','phFloat','loginForm',' ','phFloat','POST','2');
}

function hideDiv(DIVID){
	if(document.getElementById) {
		var theDiv = document.getElementById(DIVID);
		theDiv.innerHTML = "";
		theDiv.style.visibility = "hidden";
	}
}


function closeFloat(){
	if(document.getElementById) {
		var theDiv = document.getElementById('phFloat');
		var floatDiv = document.getElementById('bgFloat');
		theDiv.innerHTML = "";
		theDiv.style.visibility = "hidden";
		floatDiv.style.visibility = "hidden";
	}
}


function ShowSubMenu(show){
	var chrs = new Array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'L', 'M');
	for(i=0; i<7; i++){
		var target = "sub_"+chrs[i];
		if(target != show){
			document.getElementById(target).style.visibility = "hidden";
		}else{
			document.getElementById(target).style.visibility = "visible";
		}
	}
}


var qsParm = new Array();
var output = "";
var uu = 0;
function retrieveWYSIWYG() {
  var query = window.location.search.substring(1);
  var parms = query.split('&');
  for (var i=0; i<parms.length; i++) {
    var pos = parms[i].indexOf('=');
    if (pos > 0) {
       var key = parms[i].substring(0,pos);
       var val = parms[i].substring(pos+1);
       qsParm[key] = val;
	   output += key+": "+val+"\n";
    }
  }
}

function insertPDF(file, titolo) {
  var PDF = '<span class="pdffile"><a href="http://www.eldinternational.com/new/Downloads/PDF/'+file+'">'+titolo+'</a></span> ';
  if(uu==0) var newtext = document.getElementById("wysiwygdescr").contentWindow.document.body.innerHTML+" "+PDF;
  else  var newtext = PDF;
  document.getElementById('wysiwygdescr').contentWindow.document.write(newtext);
  //document.getElementById('wysiwygdescr').contentWindow.selection.createRange().pasteHTML(newtext);;
  // window.insertHTML(newtext, 'descr');
  uu++;
}

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;
}
