function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function changeColor(color)
{
	this.style.backgroundColor ='#'+color;
}

function divContent(div1,content)
{	
	document.getElementById(div1).innerHTML=content;
}

function bigImage(url)
{

  newWin = window.open(url, "enlarge", "menubar = 0, toolbar = 0, status = 0, resizable = 1, scrollbars=1, width = 600, height = 400");

}

var _PAGE="";
    _PAGE=""; /* Specify an actual page if you don't want to use the popup code. */

var _CONTENT=""; /* this holds the data to write if no external html file is used */

function openImageWindow2(imageSrc,imageTitle)
{
/*
 * if you use the name "_PAGE" for the page
 * you will have no problems at all
 * however if you change the name to something else
 * remember to change the reference to it in the following line of code
 * to reference your own filename..
 *
 * No _PAGE specified uses the javascript code embedded on this page.
 *
 */

	_CONTENT="";
	_CONTENT+="<HTML>\n";
	_CONTENT+="<head>\n";
	_CONTENT+="<"+"SCRIPT>\n";
	_CONTENT+="function specialInit()\n";
	_CONTENT+="{\n";
	_CONTENT+="if (document.all || document.layers)\n";
	_CONTENT+="window.resizeTo(document.images[0].width + 50,document.images[0].height + 180);\n";
	_CONTENT+="}\n";
	_CONTENT+="</"+"SCRIPT>\n";
	_CONTENT+="</head>\n";
	_CONTENT+="<BODY onLoad='specialInit();'>\n";
	_CONTENT+="<"+"SCRIPT>\n";
	_CONTENT+="document.write('<center>');\n";
	_CONTENT+="document.write('<b><font color=\\'#ffffff\\'>');\n";
	_CONTENT+="document.write('<span style=\\'BACKGROUND-COLOR:#0000ff\\'>&nbsp;');\n";
	_CONTENT+="document.write('"+imageTitle+"' +' &nbsp;</span></font></b><HR>');\n";
	_CONTENT+="document.write('<IMG SRC=\\'"+imageSrc+"\\'>');\n";
	_CONTENT+="document.write('<HR><P><P><P><FORM><INPUT TYPE=button VALUE=Close onClick=window.close()></FORM>');\n";
	_CONTENT+="document.write('</center>')\n";
	_CONTENT+="</"+"SCRIPT>\n";
	_CONTENT+="</BODY>\n";
	_CONTENT+="</HTML>\n";

 	var _parms = 'directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=yes';
 	var _windowName = "PicViewer";
	
		myWindowHandle=window.open("",_windowName,_parms);
		myWindowHandle.document.open();
		myWindowHandle.document.write(_CONTENT);
		myWindowHandle.document.close();
 	
	myWindowHandle.focus();
}


function openImageWindow(image_loc,img,width,height)
{
	if (!width) width=300;
	if (!height) height=200;
	HTML = "<html><style>body{margin:0px 0px 0px 0px}</style><body onBlur='top.close()'><img src='"+ image_loc +"' border=0 name=load_image onLoad='window.resizeTo(document.load_image.width+10,document.load_image.height+60)'></body></html>";
	popupImage = window.open('','_blank','height='+height+', width='+width+',toolbar=no,scrollbars=no');
	popupImage.document.open();
	popupImage.document.write(HTML);
	popupImage.document.close();
	obj_img = document.getElementById(img);
	obj_img.src= obj_img.src;
}
	
function openFolder(p_id)
{
  popupwindow=window.open('/easyconsole.cfm?page=myfolder&p_id='+p_id,'myfolder','width=640,height=400,scrollbars=yes');
  popupwindow.focus();
  return true;
}

function Chat()
{
  wn=window.open('/Chat/chat.htm?domain=prodromou.easyconsole.com','Chat','width=480,height=350');
}

function leaveMsg() {
  wn=window.open('/easyconsole.cfm?page=msg&print=1','LeaveMsg','width=480,height=420');
}

function sendEmail(p_id) {
	wn=window.open('/easyconsole.cfm?page=sendmail&print=1&p_id='+p_id,'SendMail','width=480,height=280');
}

function ptypeDiv(div) {
	a=document.getElementById(div);
	
	if (div=='commercialDiv')
	{
		
		a.style.display='inline';
		b=document.getElementById('residentialDiv');
		b.style.display='none';
	}
	else
	{
		a.style.display='inline';
		b=document.getElementById('commercialDiv');
		b.style.display='none';
	}
}

function locationsPopup(form)
{
	af=document.forms[form];

	if (af.town_id_list && af.town_id_list.value!='')
	{							
	
		if (af.loc_id_list2 && af.loc_id_list2.value!='') 
		{
			loc_id_list2=af.loc_id_list2.value;  	
		}
		else 
		{
			if (af.loc_id_list) loc_id_list2=af.loc_id_list.value;	else loc_id_list2='';
		}
		
		popupWidth=250;
		popupHeight=250;	
		TopDistance = (screen.height/2)-200;
		LeftDistance = (screen.width/2)-20;
		 
		mywindow=window.open("/utils/locationsPopup.cfm?target_form="+form+"&loc_id_list2="+loc_id_list2+"&town_id_list="+af.town_id_list.value,"locations","left="+LeftDistance+",top="+TopDistance+",status=yes,location=no,reload=yes,resizable=yes,scrollbars=yes,width="+popupWidth+",height="+popupHeight+"\"");
		mywindow.focus();
	}
	else
	{
		if (af.dist_id_list && af.dist_id_list.value=='') 
		{
			msg="Please select District and Town/Village"; 
		}							
		else 
		{
			msg="Please select Town/Village";
		}
		
		alert(msg);
	}
}

function showvideo(video) {
	var str = new String("/images/media/video/" + video)
	window.open(str, "movieWin", "width=320, height=240")
}

function gallerypopup(id,type,width,height) {
	if (!type) type='image';
	if (!width) width=640;
	if (!height) height=550;
	
	if (type=='image') pagename='photoviewer';
	if (type=='video') pagename='videoviewer';
	
	wn=window.open('/easyconsole.cfm?page='+pagename+'&id='+id,'gpopup','width='+width+',height='+height+',resizable=yes,scrollbars=yes');	
}

function videoPopup(m_id,width,height) {		
	window.open('/easyconsole.cfm?page=videoplayer&m_id='+m_id+'&width='+width+'&height='+height, "videoPlayer","status=no,location=no,reload=no,resizable=yes,scrollbars=no,width=340,height=310");
}