function tranzitiv(idElement, valoare)
{
document.getElementById(idElement).style.borderWidth=1;
document.getElementById(idElement).style.borderColor=valoare;
}
function redirect(tagId, mesaj, locatie, time)
{
if(strstr(document.getElementById(tagId).innerHTML,mesaj)!=false)
{
setTimeout("redirect('"+tagId+"', '"+mesaj+"', '"+locatie+"', "+time+")", time);
}
else
{
window.location = locatie;
}
}
function tryConnectCP(tagId, mesaj, ajaxPostScript, ajaxPostParameters, ajaxPostContainer, time)
{
if(strstr(document.getElementById(tagId).innerHTML,mesaj)!=false)
{
ajaxPost(ajaxPostScript, ajaxPostParameters, ajaxPostContainer);
setTimeout("tryConnectCP('"+tagId+"', '"+mesaj+"', '"+ajaxPostScript+"', '"+ajaxPostParameters+"', '"+ajaxPostContainer+"', "+time+")", time);
}
}
function strstr(haystack, needle, bool)
{
var pos = 0;
haystack += '';
pos = haystack.indexOf(needle);
if(pos == -1)
{
return false;
}
else
{
if(bool)
{
return haystack.substr(0, pos);
}
else
{
return haystack.slice( pos );
}
}
}


















function cPanelStealth(TAGcPanelStealth,actiuneNume,actiuneValoareNoua)
{
var sir=document.getElementById(TAGcPanelStealth).innerHTML;
index=sir.indexOf('|'+actiuneNume+':');
sirUnu=sir.slice(0,index+('|'+actiuneNume+':').length);
index=sir.indexOf('|',index+1);
sirDoi=sir.slice(index);
document.getElementById(TAGcPanelStealth).innerHTML=sirUnu+actiuneValoareNoua+sirDoi;
}
























function logOut(TAGcPanelStealth,mesajLogOut,mesajLogIn,cicluCurent,cicluLimita,timeBetweenLoop,logOutInAsteptare,linkAfterLogOut,idScoala)
{
//alert(idScoala);
if(chkObject(false,TAGcPanelStealth))
if(document.getElementById(TAGcPanelStealth).innerHTML.indexOf(mesajLogOut)>=0)
{
	
	if(chkObject(false,'ttt'))
	
	{
if(cicluCurent<cicluLimita)
cicluCurent++;
if(cicluCurent==cicluLimita)
{

if(document.getElementById('ttt').innerHTML.indexOf('noAccesPrivat')>=0)
window.location = linkAfterLogOut;
else//if(document.getElementById('ttt').innerHTML.indexOf('noAccesPrivat')>=0)
{
if(!logOutInAsteptare)
{
ajaxPost('resurse/privat_management_privat_strict_deconectare.php', 'logout=true&idScoala='+idScoala, 'continut');
setTimeout("logOut('"+TAGcPanelStealth+"', '"+mesajLogOut+"', '"+mesajLogIn+"', "+cicluCurent+", "+cicluLimita+", "+timeBetweenLoop+", "+true+", '"+linkAfterLogOut+"', '"+idScoala+"')", timeBetweenLoop);
}
else
setTimeout("logOut('"+TAGcPanelStealth+"', '"+mesajLogOut+"', '"+mesajLogIn+"', "+cicluCurent+", "+cicluLimita+", "+timeBetweenLoop+", "+logOutInAsteptare+", '"+linkAfterLogOut+"', '"+idScoala+"')", timeBetweenLoop);
}//if(document.getElementById('ttt').innerHTML.indexOf('noAccesPrivat')>=0)

}//if(cicluCurent==cicluLimita)
else
setTimeout("logOut('"+TAGcPanelStealth+"', '"+mesajLogOut+"', '"+mesajLogIn+"', "+cicluCurent+", "+cicluLimita+", "+timeBetweenLoop+", "+logOutInAsteptare+", '"+linkAfterLogOut+"', '"+idScoala+"')", timeBetweenLoop);
}


else//if(chkObject(false,'ttt'))
{
if(Number(timeBetweenLoop)<5000)
{
window.location = linkAfterLogOut;
}
else
{
ajaxPost('resurse/privat_management_privat_strict_deconectare.php', 'logout=true&idScoala='+idScoala, 'continut');
setTimeout("logOut('"+TAGcPanelStealth+"', '"+mesajLogOut+"', '"+mesajLogIn+"', "+cicluCurent+", "+cicluLimita+", "+3000+", "+true+", '"+linkAfterLogOut+"', '"+idScoala+"')", timeBetweenLoop);
}
}//if(chkObject(false,'ttt'))




}
else//if(document.getElementById(TAGcPanelStealth).innerHTML.indexOf(mesajLogOut)>=0)
setTimeout("logOut('"+TAGcPanelStealth+"', '"+mesajLogOut+"', '"+mesajLogIn+"', "+0+", "+cicluLimita+", "+timeBetweenLoop+", "+logOutInAsteptare+", '"+linkAfterLogOut+"', '"+idScoala+"')", timeBetweenLoop);








else//if(chkObject(false,TAGcPanelStealth))
setTimeout("logOut('"+TAGcPanelStealth+"', '"+mesajLogOut+"', '"+mesajLogIn+"', "+0+", "+cicluLimita+", "+timeBetweenLoop+", "+logOutInAsteptare+", '"+linkAfterLogOut+"', '"+idScoala+"')", timeBetweenLoop);
}
function chkObject(inParent,theVal) {
if(inParent){
if (window.opener.document.getElementById(theVal) != null) {
return true;
} else {
return false;
}
}else{
if (document.getElementById(theVal) != null) {
return true;
} else {
return false;
}
}
}
/*
Note:
chks whether an object exists or not in the document.
if the inParent is true then the object/elt is checked for its existence in the parent/opener’s document.
i.e., it will be useful to chk from a popup window.
To check in the current document itself , then set inParent value as false.
*/





function switchInputValue(unuInputTagId,doiInputTagId)
{
var auxString=document.getElementById(unuInputTagId).value;
document.getElementById(unuInputTagId).value=document.getElementById(doiInputTagId).value;
document.getElementById(doiInputTagId).value=auxString;
}


function calc (form){
var numweeks = document.getElementsByName('numweeks'); // Get the element with name

'numweeks'
for(var i=0;i<numweeks.length;i++)
{
if (numweeks[i].checked) // If the radio button is selected
var numVal = Number(numweeks[i].value); // Get the value
} // End of the for loop
form.payout.value = ((numVal * Number(form.stdhours.value) *

Number(form.monthsaccrued.value) / 12) - Number(form.hourstaken.value));
}

function get_radio_value(nameRadioInput)
{
globalInput=document.getElementsByName(nameRadioInput);
for(var i=0;i<globalInput.length;i++)
{
	
if(globalInput[i].checked)
{
return globalInput[i].value;
}
}
return false;
}
function removeAmpersandJazz(stringT)
{
stringT=stringT.replace(/\&/g, '|amperSand|');
return stringT;
}
function selectorConicaDePrezenta()
{
var uString='';
var categorieIdentificator=get_radio_value('categorie');
if(!categorieIdentificator)
{
uString='noWay';
return uString;
}
else
uString+=categorieIdentificator;
uString+=':';
var itemSelectorPrim=true;
var itemSelectorCount=1;
//alert('selectorCheckbox.'+categorieIdentificator+'.'+String(itemSelectorCount));
while(chkObject(false,'selectorCheckbox.'+categorieIdentificator+'.'+String(itemSelectorCount)))
{
if(document.getElementById('selectorCheckbox.'+categorieIdentificator+'.'+String(itemSelectorCount)).checked)
if(itemSelectorPrim)
{
uString+=document.getElementById('selector.'+categorieIdentificator+'.'+String(itemSelectorCount)).value;
itemSelectorPrim=false;
}
else
uString+=','+document.getElementById('selector.'+categorieIdentificator+'.'+String(itemSelectorCount)).value;
itemSelectorCount++;
}
if(uString=='' || uString.lastIndexOf(':')==uString.length-1)
uString='noWay';
return removeAmpersandJazz(convertHexNCR2Ascii(convertChar2HexNCR(uString)));
}
function selectorOrarProfesorRezumat()
{
var uString='';
var categorieIdentificator=get_radio_value('categorie');
if(!categorieIdentificator)
{
uString='noWay';
return uString;
}
else
uString+=categorieIdentificator;
uString+=':';
var itemSelectorPrim=true;
var itemSelectorCount=1;
//alert('selectorCheckbox.'+categorieIdentificator+'.'+String(itemSelectorCount));
while(chkObject(false,'selectorCheckbox.'+categorieIdentificator+'.'+String(itemSelectorCount)))
{
if(document.getElementById('selectorCheckbox.'+categorieIdentificator+'.'+String(itemSelectorCount)).checked)
if(itemSelectorPrim)
{
uString+=document.getElementById('selector.'+categorieIdentificator+'.'+String(itemSelectorCount)).value;
itemSelectorPrim=false;
}
else
uString+=','+document.getElementById('selector.'+categorieIdentificator+'.'+String(itemSelectorCount)).value;
itemSelectorCount++;
}
if(uString=='' || uString.lastIndexOf(':')==uString.length-1)
uString='noWay';
return removeAmpersandJazz(convertHexNCR2Ascii(convertChar2HexNCR(uString)));
}
function updateCondicaDePrezentaSelector()
{
document.getElementById('selectorConicaDePrezentaUnu').value=selectorConicaDePrezenta();
document.getElementById('selectorConicaDePrezentaDoi').value=selectorConicaDePrezenta();
}
function updateOrarProfesorRezumat()
{
document.getElementById('selectorOrarProfesorRezumat').value=selectorOrarProfesorRezumat();
}
