function SH(lnk,id,region){
	var el = document.getElementById(id);
	if (el.style.display=='none')
	{
		el.style.display='block';
		lnk.innerText = "Hide place list " + region;
	} else {
		el.style.display='none';
		lnk.innerText = "Show place list " + region;
	}
}

function send(p) {
	//try {
		var win;
		win = window.open("SendA.asp" + p,'SendArticle','height=450,width=800,scrollbars=1,status=no,toolbar=no,menubar=no,location=no,resizable=yes');
		win.focus();
	//}
	//catch (exception) {return}
}

function prnt(p) {
	try {
		var win;
		win = window.open("PrintA.asp" + p,'PrintArticle','height=400,width=620,scrollbars=1,status=no,toolbar=no,menubar=no,location=no,resizable=yes');
		win.focus();
		//win.window.print()
	}
	catch (exception) {return}
}

function sendL(p) {
	try {
		var win;
		win = window.open("SendL.asp" + p,'SendArticle','height=450,width=800,scrollbars=1,status=no,toolbar=no,menubar=no,location=no,resizable=yes');
		win.focus();
	}
	catch (exception) {return}
}

function prntL(p) {
	try {
		var win;
		win = window.open("PrintL.asp" + p,'PrintArticle','height=400,width=620,scrollbars=1,status=no,toolbar=no,menubar=no,location=no,resizable=yes');
		win.focus();
		//win.window.print()
	}
	catch (exception) {return}
}

var sPath = "http://www.visittobulgaria.com/properties/";
function validateEmail(f) {
	emailReg=/^[^@]+@[^@]+.[a-z]{2,}$/i;
	JSemail=f.sendto.value;
	if (JSemail.search(emailReg)==-1) {
		document.forms[0].sendto.focus();
		alert('Please enter a valid email address.');
		return false;
	}
	return true;
}

function checkForm(f){
	if (!validateEmail(f)) return false;
	f.ArticleTEXT.value = "<LINK href='http://www.visittobulgaria.com/visit/styles.css' type='text/css' rel='stylesheet'><br>" + htmlcontent.outerHTML;
	//alert (f.ArticleTEXT.value );
	return true;
}

function changelink(doc){
	for (var ilink=0; ilink < doc.links.length; ilink++)
	{
		//alert("1="+doc.links[ilink].href);
		if (doc.links[ilink].href.toLowerCase().indexOf("mailto:")==0) continue;
		if (doc.links[ilink].href.toLowerCase().indexOf("http://www.visittobulgaria.com")==0) continue;
		if (doc.links[ilink].href.toLowerCase().indexOf("http://noname/")==-1) continue;
		doc.links[ilink].href = "http://www.visittobulgaria.com" + doc.links[ilink].href.replace("http://" + myServer,"");
		//alert("2=" + doc.links[ilink].href);
	}
	for (var iimg=0; iimg < doc.images.length; iimg++)
	{
		if (doc.images[iimg].src.toLowerCase().indexOf("http://www.visittobulgaria.com")==0) continue;
		if (doc.images[iimg].src.toLowerCase().indexOf("http://noname/")==-1) continue;
		doc.images[iimg].src = "http://www.visittobulgaria.com" + doc.images[iimg].src.replace("http://" + myServer,"");
	}
}
function Show(ID){
var wwidth=388;
var wheight=280;
var winw = (screen.width - wwidth) / 2;
var winh = (screen.height - wheight) / 2;
var simg;
if (ID.indexOf("http://")!=0)
	simg = "http://properties.guide-bulgaria.com" + ID
else
	simg = ID
//var gallery_newpwin = window.open("show_picture.html?" + ID,"gallery","resizable=1,scrollbars=0,width="+wwidth+",height="+wheight+",top=100,left="+winh);
try
{
	var gallery_newpwin = window.open("about:blank","gallery","resizable=1,scrollbars=0,width="+wwidth+",height="+wheight+",top=100,left="+winh);
	gallery_newpwin.focus();
	gallery_newpwin.document.write("<HTML><HEAD><title>Gallery</title></HEAD>");
	gallery_newpwin.document.write("<script>function resize(){try{var img = document.images[0];window.resizeTo(img.width+15,img.height+40);}catch(e){}window.focus();}</" + "script>");
	gallery_newpwin.document.write("<body topmargin=2 leftmargin=2 bottommargin=0 rightmargin=0 onload='resize();'>	<img src='" + simg + "'></body></HTML>");
	gallery_newpwin.document.close();
}
catch (e)
{
	var gallery_newpwin = window.open("about:blank","_blank","resizable=1,scrollbars=0,width="+wwidth+",height="+wheight+",top=100,left="+winh);
	gallery_newpwin.focus();
	gallery_newpwin.document.write("<HTML><HEAD><title>Gallery</title></HEAD>");
	gallery_newpwin.document.write("<script>function resize(){try{var img = document.images[0];window.resizeTo(img.width+15,img.height+40);}catch(e){}window.focus();}</" + "script>");
	gallery_newpwin.document.write("<body topmargin=2 leftmargin=2 bottommargin=0 rightmargin=0 onload='resize();'>	<img src='" + simg + "'></body></HTML>");
	gallery_newpwin.document.close();
}
}

function Request(productid){
	d = new Date();
	var requestwin = window.open('Property_Request.asp?ProductID=' + productid +'&d=' + d.getTime(), 'requestwin' + productid, 'height=500,width=600,status=1,resizable=1,scrollbars=1');
}

function RequestOnOff(brokerid, productid, clientid){
	d = new Date();
	var requestwin = window.open('http://support.Guide-Bulgaria.com/chat/isonline_rd.asp?b=' + brokerid + '&p=' + productid +'&d=' + d.getTime(), 'b'+brokerid+'c'+clientid, 'height=500,width=600,status=1,resizable=1,scrollbars=1,menubar=0');
}
