﻿var widthWhenMinGlobal='';
var widthWhenMaxGlobal = '';
var isClosed = true;

function showAlert(title, content, widthWhenMin, widthWhenMax) {
    if(widthWhenMin!=null)
	widthWhenMinGlobal = widthWhenMin + 'px';
	if(widthWhenMax!=null)
	widthWhenMaxGlobal = widthWhenMax + 'px';
	var divAlert = document.getElementById("alert");
	if(divAlert == null){
	_newAlert = document.createElement('div');
	_newAlert.id = 'alert';
	_newAlert.className = 'alert-div';

	_newTitleBar = document.createElement('div');
	_newTitleBar.className = 'title-bar';
	_newTitleBar.onmouseover = function (){ if(_newAlertContent.style.display="none") maxAlert(); };
	_newTitleBar.onmouseout = function (){ minAlert(); };

	_newAlertTitle = document.createElement('div');
	_newAlertTitle.id = 'alert-title';

	_newMinBtn = document.createElement('a');
	_newMinBtn.id = 'min-btn';
	_newMinBtn.href = 'javascript:minAlert()';

	_newAlertContent = document.createElement('div');
	_newAlertContent.id = 'alert-content';
	_newAlertContent.className = 'content-area';
	_newAlertContent.onmouseover = function (){ maxAlert(); };
	_newAlertContent.onmouseout = function (){ minAlert(); };

	_newAlert.appendChild(_newTitleBar);
	_newAlert.appendChild(_newAlertContent);
	_newTitleBar.appendChild(_newAlertTitle);
	_newTitleBar.appendChild(_newMinBtn);
	

	_newAlertTitle.innerHTML = title;
	_newAlertContent.innerHTML = content;
	_newAlert.style.width = widthWhenMaxGlobal;
	_newAlert.style.display = "block";
	
	//alert(_newAlert.innerHTML);
	document.body.appendChild(_newAlert);	
	setTimeout('minAlert()',5000);
	}
	else{	
	    var _newAlertTitle= document.getElementById("alert-title");
	    var _newAlertContent = document.getElementById("alert-content");
	    _newAlertTitle.innerHTML = title;
	    _newAlertContent.innerHTML = content;
	}
}

function maxAlert(){
	document.getElementById('alert-content').style.display = "block";
	document.getElementById('alert').style.width = widthWhenMaxGlobal;
}

function minAlert(){
	document.getElementById('alert-content').style.display = "none";
	document.getElementById('alert').style.width = widthWhenMinGlobal;
}


function ReportQuestion(questionID, pageUrl) {
    var flagContentDialog = new Dialog({	        
	        title:'Report this Topic',
	        width: 345,
	        height: 290,
	        padding:0,
	        margin:0,
	        iframe: baseURL + '/FlagContent.aspx?pageUrl=' + pageUrl + '&id=' + questionID,	        
	        close:{link:true,overlay:false,esc:true}
	      
        });

	    flagContentDialog.open();
      }

      function ReportQuestionWithCloseFunction(questionID, pageUrl, onCloseFunction) {
          var flagContentDialog = new Dialog({
              title: 'Report this Topic',
              width: 345,
              height: 290,
              padding: 0,
              margin: 0,
              iframe: baseURL + '/FlagContent.aspx?pageUrl=' + pageUrl + '&id=' + questionID,
              close: { link: true, overlay: false, esc: true },
              afterClose: onCloseFunction
          });
          flagContentDialog.open();
      }

     
