﻿
function showAlertDiv(text){  
try{

    alertText=text;
    mHeight = 330;
    mWidth = (document.body.clientWidth/2)-250;
    
    document.getElementById('AlertBox').style.left=mWidth+'px';    
	document.getElementById('AlertBox').style.top=mHeight+'px';	
	document.getElementById('AlertBox').style.zIndex="1";	
	document.getElementById('AlertBox').style.position="fixed";	
    document.getElementById('AlertBox').innerHTML="";    
    
    div="<img onclick=closeAlertDiv(); onmouseover=repImage();  align='right' src='./images/CloseDiv.gif'/><br/><br/><table><tr><td valign='top'><img align='right'  src='./images/ErrorIcon.png'/></td><td style='color:black;'>"+alertText+"</td></tr></table>";
    
    var wth=document.body.clientWidth;
    var hth=document.body.clientHeight;
  
    document.getElementById('FullDIV').style.left=0+'px';   
	document.getElementById('FullDIV').style.top=0+'px';	
	document.getElementById('FullDIV').style.width=wth+'px';
	document.getElementById('FullDIV').style.height=hth+'px';    
    document.getElementById("FullDIV").style.display = "inline-block";  
    document.getElementById('FullDIV').getAttribute('style').zIndex="0";     
    
    document.getElementById("AlertBox").style.display = "inline-block";    
    document.getElementById('AlertBox').innerHTML=div;
      
    }catch(e){
  alert(e.number & 0xFFFF)
  alert(e.description)
  }   
}

function closeAlertDiv(){
    document.getElementById('AlertBox').style.display = "none";
    document.getElementById('FullDIV').style.display = "none";
}

function repImage(){
    document.getElementById('AlertBox').innerHTML="";
    ppp = "<img onclick='closeAlertDiv();' onmouseout='resImage();' alt='بستن پنجره' align='right' src='./images/RolloverCloseDiv.gif'/><br/><br/><table><tr><td valign='top'><img align='right'  src='./images/ErrorIcon.png'/></td><td style='color:black;'>" + alertText + "</td></tr></table>";
    document.getElementById('AlertBox').innerHTML=ppp;       
}

function resImage(){
    document.getElementById('AlertBox').innerHTML="";
    ttt = "<img onclick='closeAlertDiv();'  onmouseover='repImage();'  align='right' src='./images/CloseDiv.gif'/><br/><br/><table><tr><td valign='top'><img align='right'  src='./images/ErrorIcon.png'/></td><td style='color:black;'>" + alertText + "</td></tr></table>";
    document.getElementById('AlertBox').innerHTML=ttt;
}

function openwin(){    
    window.open('SendToFriends.aspx','','scrollbars=no,menubar=no,height=350,width=550,resizable=no,toolbar=no,location=no,status=yes,left=380,top=100');    
    }
    
    
function openprintwin(){
var printurl=window.location.toString();
var printurlID=printurl.indexOf('id='); 

    window.open('printcontent.aspx?contentid='+printurl.substring(printurlID+3),'','scrollbars=yes,menubar=no,width=735, height=600,resizable=no,toolbar=no,location=no,status=yes,left=300,top=50');    
}
//====================================== Agency ============================================

function openAgencyContent(textboxID) {    
    window.open('AgencyContent.aspx?txtid=' + textboxID, '', 'scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=yes,location=no,status=yes,left=50,top=50');
}

function FillAgencyContent(textboxID_Content) {
    document.getElementById('elm1').value = window.opener.document.getElementById(textboxID_Content).value;    
}

function setAgencyContent(textboxID_Content) {    
    window.opener.document.getElementById(textboxID_Content).value = document.getElementById('elm1').value;
    window.close();
}

function imageEffect_over(item) {
    imageitemwidth = item.width;
    imageitemheight = item.height;
    
    item.width = imageitemwidth+ 10;
    item.height = imageitemheight+ 10;
}

function imageEffect_out(item) {
    item.width = imageitemwidth;
    item.height = imageitemheight;
}









