//disabled = false;
disabled = false;
function submitPassdata(objHTML){
	
	if(document.getElementById('frm_passdata').logout && document.getElementById('frm_passdata').logout.value == 1){
		var strLocation;
		strLocation = "logout.asp?nextLocation=" + objHTML.getAttribute('href');
		strLocation +="&ida=" + document.getElementById('frm_passdata').ida.value;
		strLocation +="&boton=" + objHTML.getAttribute("buttonID"); 
		strLocation +="&barratopvisible=" + document.getElementById('frm_passdata').barratopvisible.value;
		parent.__idContentFrame.location = strLocation;
	}else{
	/*
	if(objHTML.getAttribute("exitCourse")){
		if(objHTML.getAttribute("exitCourse") == 1){
			document.getElementById('frm_passdata').ida
		}
	}
	*/
	
	
	
	if(objHTML.getAttribute("buttonID")){
		addMainFrmElement("boton", objHTML.getAttribute("buttonID"));
	}
	
	if(objHTML.getAttribute("isAdmin")){
		addMainFrmElement("isAdmin", objHTML.getAttribute("isAdmin"));
	}
	
	if(objHTML.getAttribute("encuestaID")){
		addMainFrmElement("encuestaid", objHTML.getAttribute("encuestaID"));
	}
	if(objHTML.getAttribute("albumID")){
		addMainFrmElement("albumid", objHTML.getAttribute("albumID"));
	}
	if(objHTML.getAttribute("pictureID")){
		addMainFrmElement("pictureid", objHTML.getAttribute("pictureID"));
	}
	if(objHTML.getAttribute("fileID")){
		addMainFrmElement("fileid", objHTML.getAttribute("fileID"));
	}
	if(objHTML.getAttribute("faqID")){
		addMainFrmElement("faqid", objHTML.getAttribute("faqID"));
	}
	if(objHTML.getAttribute("grupoID")){
		addMainFrmElement("idgrupo", objHTML.getAttribute("grupoID"));
	}
	if(objHTML.getAttribute("pictureOrder")){
		addMainFrmElement("pictureorder", objHTML.getAttribute("pictureOrder"));
	}
	if(objHTML.getAttribute("categoryID")){
		addMainFrmElement("categoryid", objHTML.getAttribute("categoryID"));
	}
	if(objHTML.getAttribute("videoID")){
		addMainFrmElement("videoid", objHTML.getAttribute("videoID"));
	}
	if(objHTML.getAttribute("examenID")){
		addMainFrmElement("examenid", objHTML.getAttribute("examenID"));
	}
	if(objHTML.getAttribute("padreContentID")){
		addMainFrmElement("padrecontentid", objHTML.getAttribute("padreContentID"));
	}
	if(objHTML.getAttribute("tid")){
		addMainFrmElement("tid", objHTML.getAttribute("tid"));
	}
	if(objHTML.getAttribute("tau_id")){
		addMainFrmElement("tau_id", objHTML.getAttribute("tau_id"));
	}
	if(objHTML.getAttribute("qid")){
		addMainFrmElement("qid", objHTML.getAttribute("qid"));
	}
	if(objHTML.getAttribute("start")){
		addMainFrmElement("start", objHTML.getAttribute("start"));
	}
	if(objHTML.getAttribute("mcqid")){
		addMainFrmElement("mcqid", objHTML.getAttribute("mcqid"));
	}
	if(objHTML.getAttribute("mark_id")){
		addMainFrmElement("mark_id", objHTML.getAttribute("mark_id"));
	}
	if(objHTML.getAttribute("idc")){
		addMainFrmElement("idc", objHTML.getAttribute("idc"));
	}
	if(objHTML.getAttribute("item_id")){
		addMainFrmElement("item_id", objHTML.getAttribute("item_id"));
	}
	if(objHTML.getAttribute("item_type")){
		addMainFrmElement("item_type", objHTML.getAttribute("item_type"));
	}
	if(objHTML.getAttribute("parent_id")){
		addMainFrmElement("parent_id", objHTML.getAttribute("parent_id"));
	}
	if(objHTML.getAttribute("parent_type")){
		addMainFrmElement("parent_type", objHTML.getAttribute("parent_type"));
	}
	if(objHTML.getAttribute("barravisible")){
		addMainFrmElement("barravisible", objHTML.getAttribute("barravisible"));
	}
	if(objHTML.getAttribute("accion")){
		addMainFrmElement("accion", objHTML.getAttribute("accion"));
	}
	if(objHTML.getAttribute("status")){
		addMainFrmElement("status", objHTML.getAttribute("status"));
	}
	if(objHTML.getAttribute("nick")){
		addMainFrmElement("nick", objHTML.getAttribute("nick"));
	}
	if(objHTML.getAttribute("newsID")){
		addMainFrmElement("newsid", objHTML.getAttribute("newsID"));
	}	
	if(objHTML.getAttribute("mailID")){
		addMainFrmElement("mailid", objHTML.getAttribute("mailID"));
	}
	if(objHTML.getAttribute("mailFolder")){
		addMainFrmElement("mailFolder", objHTML.getAttribute("mailFolder"));
	}
    
	if(objHTML.getAttribute("lastVisitedContent")){
		addMainFrmElement("lastvisitedcontent", objHTML.getAttribute("lastVisitedContent"));
	}	

	//document.getElementById('frm_passdata').action = document.getElementById(objHTML).href;
	document.getElementById('frm_passdata').action = objHTML.getAttribute('href');
	
	if(objHTML.getAttribute("target")=="_new") {
        document.getElementById('frm_passdata').target="_new";
    }
	if(!disabled){
		document.getElementById('frm_passdata').submit();
	}
	disabled = true;
	//element.runtimeStyle.cursor = "wait"
}
}

function lookUpInputByName(objForm, inputName){
	for(i=0;i<objForm.elements.length;i++){
		if(objForm.elements[i].name == inputName){
			return i;
		}
	}
	return -1; //not found
}
function createNewHidden(name, value){
	var objHidden = document.createElement("input")
	objHidden.setAttribute("name", name);
	objHidden.setAttribute("id", name);
	objHidden.setAttribute("value", value);
	objHidden.setAttribute("type", "hidden");	
	return objHidden
}

function addMainFrmElement(name, value){
	var passDataFrm = document.forms["frm_passdata"];
	var inputNumber = lookUpInputByName(passDataFrm,name);
	
	if (document.getElementById(name)){
		document.forms["frm_passdata"][name].value = value;
	} else {
		document.forms["frm_passdata"].appendChild(createNewHidden(name, value));
	}
	
	/*
	if(inputNumber != -1){
		lookedUpObj = passDataFrm.elements[inputNumber];
		lookedUpObj = value;
	}else{
		document.forms["frm_passdata"].elements.appendChild(createNewHidden(name, value));
	}
	*/
		
}
