var popupH=0.94;
var popupW=80;
var popupWinH=0.03;
var popupBackGround='';
var popupBorder='';
var popupBackGroundColor='';
function fillDHTMLAlertPopupDiv(id, dir, nH)
{
	var iTableHeight = window.innerWidth ? window.innerHeight : document.body.clientHeight;
	var iTablePadTop=parseInt(iTableHeight*0.3);
	var marginW=((document.body.scrollWidth-parseFloat(popupW))/2)+1;
	iTableHeight=popupH;
	var iTablePadBottom=(nH-iTablePadTop-iTableHeight)+2;
	var o='<table id="'+ id + 'DataTable" border="0" cellspacing="0" cellpadding="0" dir="' + dir + '">';
	o += ' <tr>';
	o += '  <td width="'+marginW+'px" height="' + iTablePadTop + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td width="'+popupW+'px" height="' + iTablePadTop + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td width="'+marginW+'px" height="' + iTablePadTop + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += ' </tr>';
	o += ' <tr>';
	o += '  <td "'+marginW+'px" height="' + iTableHeight + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td "'+popupW+'px" height="' + iTableHeight + 'px" >';
	o += '   <table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"  dir="' + dir + '">';
	o += '    <tr>';
	o += '     <td valign="top">';
	o += '      <div id="'+ id + 'LayoutDiv" style="height:100px;width:100%;overflow:auto;"><div id="'+ id + 'ContentDiv"></div></div>';
	o += '     </td>';
	o += '    </tr>';
	o += '   </table>';
	o += '  </td>';
	o += '  <td "'+marginW+'px" height="' + iTableHeight + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += ' </tr>';
	o += ' <tr>';
	o += '  <td width="'+marginW+'px" height="' + iTablePadBottom + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td width="'+popupW+'px" height="' + iTablePadBottom + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td width="'+marginW+'px" height="' + iTablePadBottom + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += ' </tr>';
	o += '</table>';
	return(o);
}

function fixDHTMLAlertPopupDivHeight(id)
{
	if ((document.getElementById(id + 'LayoutDiv').parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.offsetHeight))
	{ document.getElementById(id + 'LayoutDiv').style.height=document.getElementById(id + 'LayoutDiv').parentNode.offsetHeight+'px'; }
	else if ((document.getElementById(id + 'LayoutDiv').parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode.offsetHeight))
	{ document.getElementById(id + 'LayoutDiv').style.height=document.getElementById(id + 'LayoutDiv').parentNode.parentNode.offsetHeight+'px'; }
	else if ((document.getElementById(id + 'LayoutDiv').parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode.parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode.parentNode.offsetHeight))
	{ document.getElementById(id + 'LayoutDiv').style.height=document.getElementById(id + 'LayoutDiv').parentNode.parentNode.parentNode.offsetHeight+'px'; }
}

function openDHTMLAlertPopup(id, dir,param1,param2,param3,pH,pW)
{
	popupH=parseFloat(pH);
	popupW=parseFloat(pW);
	var d=document.getElementById('dhtmlPopupTag' + id);
	var sRes=0;
	if (! d) { return; }
	var nH = document.body.scrollHeight-10;
	d.style.height=nH+'px';
	var picDir="en";
	if(dir=="rtl"){  picDir="he"; }
	var s='<table border="0" align="center" cellpadding="0" cellspacing="0" style="border-bottom:1px solid #BABAC3;border-right:1px solid #BABAC3;border-top:1px solid #ffffff;border-left:1px solid #ffffff">';
	s+='<tr>';
	s+='<td>';
	s+='<table border="0" align="center" cellpadding="0" cellspacing="0">';
	s+='<tr> ';
	s+='<td width="10" class="bordersAlphaChanges"><img src="/templates/admin/consumer/'+picDir+'/gfx/del.gif" width="1" height="1"></td>';
	s+='<td height="10" class="bordersAlphaChanges"><img src="/templates/admin/consumer/'+picDir+'/gfx/del.gif" width="1" height="1"></td>';
	s+='<td width="10" class="bordersAlphaChanges"><img src="/templates/admin/consumer/'+picDir+'/gfx/del.gif" width="1" height="1"></td>';
	s+='</tr>';
	s+='<tr> ';
	s+='<td width="10" class="bordersAlphaChanges"><img src="/templates/admin/consumer/'+picDir+'/gfx/del.gif" width="1" height="1"></td>';
	s+='<td valign="top" bgcolor="#E8E8E8" style="border:1px solid #444C53">';
	s+='<table width="100%" border="0" cellpadding="0" cellspacing="0">';
	s+='<tr> ';
	s+='<td align="center">';
	s+='<table width="0%" border="0" cellspacing="0" cellpadding="6">';
	s+='<tr> ';
	s+='<td><img src="/templates/admin/consumer/'+picDir+'/gfx/icon_save.gif" width="60" height="65"></td>';
	s+='<td class="saveChangesText" style="white-space: nowrap;">'+param3+' ?';
	s+='</td>';
	s+='</tr>';
	s+='</table>';
	s+='</td>';
	s+='</tr>';
	s+='<tr> ';
	s+='<td height="60" align="center">';
	s+='<table width="0%" border="0" cellspacing="0" cellpadding="6">';
	s+='<tr>';
	s+='<td align="{LANG_ALIGN_START}"><input type="button" name="Alert1" value="Yes" class="button_changeYes" onclick="'+param1+'"></td>';
	s+='<td align="center"><input type="button" name="Alert2" value="No" class="button_changeNo" onclick="'+param2+'"></td>';
	s+='<td align="{LANG_ALIGN_END}"><input type="button" name="Alert3" value="Cancel" class="button_changeCancel" onclick="closeDHTMLAlertPopup();return 3;"></td>';
	s+='</tr>';
	s+='</table>';
	s+='</td>';
	s+='</tr>';
	s+='</table>';
	s+='</td>';
	s+='<td width="10" class="bordersAlphaChanges"><img src="/templates/admin/consumer/'+picDir+'/gfx/del.gif" width="1" height="1"></td>';
	s+='</tr>';
	s+='<tr> ';
	s+='<td width="10" class="bordersAlphaChanges"><img src="/templates/admin/consumer/'+picDir+'/gfx/del.gif" width="1" height="1"></td>';
	s+='<td height="10" class="bordersAlphaChanges"><img src="/templates/admin/consumer/'+picDir+'/gfx/del.gif" width="1" height="1"></td>';
	s+='<td width="10" class="bordersAlphaChanges"><img src="/templates/admin/consumer/'+picDir+'/gfx/del.gif" width="1" height="1"></td>';
	s+='</tr>';
	s+='</table>';
	s+='</td>';
	s+='</tr>';
	s+='</table>';
	var idlen=''+id;
	idlen=idlen.length;
	if ((s.substring(0, 35+idlen).toLowerCase()!='<table id=' + String.fromCharCode(34) + 'dhtmlpopuptag' + id + 'datatable' + String.fromCharCode(34) + ' ')&&(s.substring(0, 33+idlen).toLowerCase()!='<table id=dhtmlpopuptag' + id + 'datatable '))
	{ sRes=1; d.innerHTML=fillDHTMLAlertPopupDiv('dhtmlPopupTag' + id, dir, nH); }
	window.scrollTo(0,0);
	d.style.display='';
	if (sRes)
	{
		fixDHTMLAlertPopupDivHeight('dhtmlPopupTag' + id);
		document.getElementById('dhtmlPopupTag' + id + 'ContentDiv').innerHTML=s;
	}
}

function fillDHTMLPopupDivCons(id, dir, nH,closeFunction)
{
	var iTableHeight = window.innerWidth ? window.innerHeight : document.body.clientHeight;
	var iTablePadTop=parseInt(iTableHeight*popupWinH);
	var marginW=((document.body.scrollWidth-parseFloat(popupW))/2)+1;
	iTableHeight=popupH;
	var iTablePadBottom=(nH-iTablePadTop-iTableHeight)+2;
	var picDir="en";
	if(dir=="rtl"){  picDir="he"; }
	var o='<table id="'+ id + 'DataTable"  width="100%" height="' + nH + '" border="0" cellspacing="0" cellpadding="0" dir="' + dir + '">';
	o += ' <tr>';
	o += '  <td width="'+marginW+'px" height="' + iTablePadTop + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="'+popupBackGround+';filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td width="'+popupW+'px" height="' + iTablePadTop + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="'+popupBackGround+';filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td width="'+marginW+'px" height="' + iTablePadTop + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="'+popupBackGround+';filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += ' </tr>';
	o += ' <tr>';
	o += '  <td width="'+marginW+'px" height="' + iTableHeight + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="'+popupBackGround+';filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td width="'+popupW+'px" height="' + iTableHeight + 'px" '+popupBackGroundColor+' >';
	o += '   <table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" style="'+popupBorder+'" dir="' + dir + '">';
	o += '    <tr>';
	o += '     <td valign="top">';
	o += '      <div id="'+ id + 'LayoutDiv" style="position:relative;height:100px;width:100%;overflow:auto;">';
	if((closeFunction!="")&&(closeFunction!=undefined)&&(closeFunction!=null))
	{
	 if (dir=='ltr') { closeIconXPos='right:6px;'; } else { closeIconXPos='left:6px;'; }
	 o += '<img style="cursor: pointer;cursor: hand;position:absolute;'+closeIconXPos+' top:6px;" src="/templates/admin/consumer/'+picDir+'/gfx/icon_close.gif" width="27" height="27" onclick="parent.'+closeFunction+'();">';
	}
	o += '<div id="'+ id + 'ContentDiv"></div></div>';
	o += '     </td>';
	o += '    </tr>';
	o += '   </table>';
	o += '  </td>';
	o += '  <td width="'+marginW+'px" height="' + iTableHeight + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="'+popupBackGround+';filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += ' </tr>';
	o += ' <tr>';
	o += '  <td width="'+marginW+'px" height="' + iTablePadBottom + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="'+popupBackGround+';filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td width="'+popupW+'px" height="' + iTablePadBottom + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="'+popupBackGround+';filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += '  <td width="'+marginW+'px" height="' + iTablePadBottom + 'px"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0" dir="' + dir + '" style="'+popupBackGround+';filter:alpha(opacity=50);-moz-opacity:0.7;opacity:0.7;"><tr><td></td></tr></table></td>';
	o += ' </tr>';
	o += '</table>';
	return(o);
}

function fixDHTMLPopupDivHeightCons(id)
{
	if ((document.getElementById(id + 'LayoutDiv').parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.offsetHeight))
	{ document.getElementById(id + 'LayoutDiv').style.height=document.getElementById(id + 'LayoutDiv').parentNode.offsetHeight+'px'; }
	else if ((document.getElementById(id + 'LayoutDiv').parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode.offsetHeight))
	{ document.getElementById(id + 'LayoutDiv').style.height=document.getElementById(id + 'LayoutDiv').parentNode.parentNode.offsetHeight+'px'; }
	else if ((document.getElementById(id + 'LayoutDiv').parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode.parentNode)&&(document.getElementById(id + 'LayoutDiv').parentNode.parentNode.parentNode.offsetHeight))
	{ document.getElementById(id + 'LayoutDiv').style.height=document.getElementById(id + 'LayoutDiv').parentNode.parentNode.parentNode.offsetHeight+'px'; }
}


function openDHTMLPopupCons(id, hlpfrm, dir,pH,pW,pWH,opacity,closeFunction)
{
	var docH;
	popupH=parseFloat(pH);
	popupW=parseFloat(pW);
	popupWinH=parseFloat(pWH);
	popupBackGroundColor="";
	popupBackGround="";
	popupBorder="";
	if(opacity==1)
	{
		popupBorder='border: 1px solid #000000;';
		popupBackGround="background-color:#94B0C6";
		popupBackGroundColor='bgcolor="#94B0C6"';
	}
	popupOpac=parseFloat(opacity)/10;
	if (window.innerWidth) { docH=window.innerHeight-2; } else { docH=document.body.clientHeight; }
	document.getElementById('bodyDiv').style.overflow='hidden';
	document.getElementById('bodyDiv').style.height=(docH)+'px';
	var d=document.getElementById('dhtmlPopupTag' + id);
	var sRes=0;
	if (! d) { return; }
	var nH = (document.body.scrollHeight-2);
	d.style.height=nH+'px';
	var s=d.innerHTML;
	var idlen=''+id;
	idlen=idlen.length;
	if ((s.substring(0, 35+idlen).toLowerCase()!='<table id=' + String.fromCharCode(34) + 'dhtmlpopuptag' + id + 'datatable' + String.fromCharCode(34) + ' ')&&(s.substring(0, 33+idlen).toLowerCase()!='<table id=dhtmlpopuptag' + id + 'datatable '))
	{ sRes=1; d.innerHTML=fillDHTMLPopupDivCons('dhtmlPopupTag' + id, dir, nH,closeFunction); }
	window.scrollTo(0,0);
	d.style.display='';
	if (sRes)
	{
		fixDHTMLPopupDivHeightCons('dhtmlPopupTag' + id);
		document.getElementById('dhtmlPopupTag' + id + 'ContentDiv').innerHTML=hlpfrm;
	}
}

