function openWindow(url,platos,ipsos){popupWin=window.open(url,'new_page','width='+platos+', height='+ipsos+',scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no,status=no,directories=no,copyhistory=no');popupWin.focus();}
function hide_info_bubble(div_id,xbutton){if(xbutton="1"){$(div_id).hide();}}
function show_hide_div(div_id,cross){var div_id;$(div_id).style.display=$(div_id).style.display=='none'?'':'none';if(cross!=""){$(cross).innerHTML=="[-]"?$(cross).innerHTML="[+]":$(cross).innerHTML="[-]";}}
function show_hide_many(div_id,cross){var div_id;for (var i = 0; i < div_id.length; i++) {$(div_id[i]).style.display=$(div_id[i]).style.display=='none'?'':'none';}	if(cross!=""){$(cross).innerHTML=="[-]"?$(cross).innerHTML="[+]":$(cross).innerHTML="[-]";}}
function infoBox(div_id,title,desc,width,xbutton){var div_id;var title;var desc;var width;var xbutton;if($(div_id).style.display=='none'){if(xbutton==1){xbuttonContent='<div align=right style="padding-top:5px"><a href="#" onclick="hide_info_bubble(\''+div_id+'\',\''+xbutton+'\');return false;"><img alt="" border="0" src="./images/closesm.gif"></a></div>';}
else if(xbutton==0){xbuttonContent='';}
var bubbleContent='<div class="infoBoxBubble" style="width:'+width+';"><span class="infoBoxTitle">'+title+'</span><br><span class="infoBoxText">'+desc+'</span>'+xbuttonContent+'</div>';$(div_id).innerHTML=bubbleContent;$(div_id).show();$(div_id).style.position='absolute';}
else{if(xbutton==1){$(div_id).hide();}}
new Draggable(div_id);}
function openConfirmBox(url,text){$('screenblur').show();var confirmBoxHeight=$('confirmBox').getHeight();var confirmBoxWidth=$('confirmBox').getWidth();function boxPosition(){var viewPortWidth=document.viewport.getWidth();var viewPortHeight=document.viewport.getHeight();var fromTop=((viewPortHeight/2)-confirmBoxHeight);var fromLeft=((viewPortWidth-confirmBoxWidth)/2);$('confirmBox').style.top=(fromTop<0?0:fromTop)+'px';$('confirmBox').style.left=(fromLeft<0?0:fromLeft)+'px';$('confirmBox').style.position='fixed';}
boxPosition();$('confirmBoxtext').innerHTML=text;$('theurl').value=url;$('confirmBox').show();new Draggable('confirmBox');window.onresize=boxPosition;window.onscroll=boxPosition;return false;}
function closeConfirmBox(str){$('screenblur').hide();$('confirmBox').hide();if(str=='yes'){if($F('theurl')!=''){var url=$F('theurl');var params=$F("theparams");if($F("isAjax")=="1"){new Ajax.Request(url,{onComplete:showResponse,onException:showException,onFailure:showException,asynchronous:true,method:'post',evalScripts:false,postBody:params});}else{document.location.href=$F('theurl');}}else{alert('Url is missing!');}}else if(str=='no'&&$F('theurl')!=''&&$F("isAjax")=="1"){$("loading").hide();$("delete","confirm").invoke("enable");}}
function showResponse(req){if(req.responseText.indexOf("sessionexpired")!=-1){$F("isAjax").value="";alert('Your session has expired');document.location.href="index.asp"}else{$F("isAjax").value="";document.location.href=req.responseText;}}
function showException(req){$F("isAjax").value="";openmessageBox(req.responseText);}
function openAlertBox(text){$('screenblur').show();var confirmBoxHeight=$('alertBox').getHeight();var confirmBoxWidth=$('alertBox').getWidth();function boxPosition(){var viewPortWidth=document.viewport.getWidth();var viewPortHeight=document.viewport.getHeight();var fromTop=((viewPortHeight/2)-confirmBoxHeight);var fromLeft=((viewPortWidth-confirmBoxWidth)/2);$('alertBox').style.top=(fromTop<0?0:fromTop)+'px';$('alertBox').style.left=(fromLeft<0?0:fromLeft)+'px';$('alertBox').style.position='fixed';}
boxPosition();$('alertBoxtext').innerHTML=text;$('alertBox').show();new Draggable('alertBox');window.onresize=boxPosition;window.onscroll=boxPosition;return false;}
function closeAlertBox(str){$('screenblur').hide();$('alertBox').hide();}
function openmessageBox(text){var messageBox=document.createElement('div');var messageBoxContent='<div class="messageBoxBubble"><span id="messageBoxText">'+text+'</span></div>';messageBox.innerHTML=messageBoxContent;$('container').appendChild(messageBox);messageBox.style.position='absolute'; messageBox.style.zIndex='1000';var messageBoxHeight=Element.getHeight(messageBox);var messageBoxWidth=Element.getWidth(messageBox);var fromTop=(document.viewport.getScrollOffsets().top)+messageBoxHeight+10;var fromLeft=(document.viewport.getScrollOffsets().left)+((document.viewport.getWidth()-messageBoxWidth-10));messageBox.style.top=(fromTop<0?0:fromTop)+'px';messageBox.style.left=(fromLeft<0?0:fromLeft)+'px';messageBox.show();messageBox.fade({duration:5.0});}
function closemessageBox(str){$('messageBox').hide();}
function showSmallLoader(div){$(div).show();$(div).innerHTML='<img src="./images/waitSmall.gif">';}
function isGoodEmail(field){var fieldValue=$F(field);var goodEmail=fieldValue.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\.arpa)|(\.asia)|(\.cat)|(\.int)|(\.jobs)|(\.tel)|(\.travel)|(\.xxx)|(\..{2,2}))$)\b/gi);apos=fieldValue.indexOf("@");dotpos=fieldValue.lastIndexOf(".");lastpos=fieldValue.length-1;var badEmail=(apos<1||dotpos-apos<2||lastpos-dotpos<2);if(goodEmail&&!badEmail){return true;}
else{return false;}}
function showBigLoader(div){$(div).show();$(div).innerHTML='<img id="bigLoader" src="./images/waitBig.gif">';}
