﻿/* dml stuff */


// ------- > Popup windows start
// in the onclick, only the URL is required
// the 'features' parameter can be 'noscrollbars' or 'fullwindow' or 'noscrollbars,fullwindow' (order doesn't matter)
//example function call: onclick="function popMe('http://google.com/','500','600','100','50','fullwindow,noscrollbars')"
var popup=0;
function popMe(newURL,width,height,top,left,features)
{
	//alert('popMe');
	if(!features){var features = '';}
	//if (features.indexOf('fullwindow') == '-1') {var _fullwindow = 'no';}
	//else {
	var _fullwindow = 'yes';
	//}
	if (features.indexOf('noscrollbars') == '-1') {var _scrollbars = 'yes';}
	else {var _scrollbars = 'no';}
	if (top == '' || !top) {top = '25';}
	if (left == '' || !left) {left = '35';}
		
	popup = 
	window.open(newURL,'popup_window','toolbar='+_fullwindow+',location=yes,directories=no,status='+_fullwindow+',menubar='+_fullwindow+',scrollbars='+_scrollbars+',resizable=yes,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top);
	popup.focus();
	//return false;
}
// Popup windows end ------>

// ------- > Popup images start
// rememeber to preload popup image
function popImage(divName,imgSrc){
	var theDiv = document.getElementById(divName);
	//var theImg = theDiv.getElementsByTagName('img')[0];
	
	//theImg.src = imgSrc;
	//theDiv.style.float = 'right';
	//theDiv.innerHTML = '<img src="'+imgSrc+'" style="position:absolute; right:10px;">' + theDiv.innerHTML;
	
	theDiv.innerHTML += '<div id="poppedMeUp" style="position:absolute; right:30%; top:140px;"><a href="#" onClick=closeDiv("poppedMeUp");><img src="'+imgSrc+'" alt="" border="0"></a><div class="pop_link"><a href="#" onClick=closeDiv("poppedMeUp");>Close [x]</a></div></div>';
	
	//'<div class="pop_image" id="pop_image_1"><a href="#" onClick=popImage("pop_image_1','images/dwq_online_permits.jpg");><img src="images/dwq_online_permits.jpg" alt="" border="0"><div class="pop_link">Close [x]</a></div></div>';
	
	//alert(theDiv.innerHTML);
	//document.eval(imgName).src = newSrc;
}
function closeDiv(theDiv)
{
	//alert('closeDiv');
	var theContainer = document.getElementById(theDiv);
	//theContainer.innerHTML="";
	theContainer.style.display='none';
}
// ------- > Popup images end

// --------> start Preloader
//Example: preload('images/myimage1.gif','images/myimage2.gif','images/myimage3.gif')
function preload()
{ 
  var imagenames = preload.arguments;
  document.imageArray = new Array(imagenames.length);
  for(var i=0; i<imagenames.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = imagenames[i];
	//alert(imagenames[i] + ' preloaded');
  }
}
// --------> end Preloader



/* end dml stuff */