function Promeo(lang)
{
	this.lang = lang;
}

Promeo.prototype.getZIP = function(propertyid)
{
	var text;
	switch (this.lang)
	{
		default:
		case 'es': text = 'Creando ZIP...';    break;
		case 'de': text = 'Erstelle ZIP...';   break;
		case 'fr':
		case 'en': text = 'Creating ZIP...';   break;
	}
	
	fetch_obj('dll').innerHTML = text;
	window.location = 'http://www.promeo24.com/' + this.lang + '/download/photos/' + propertyid + '/';
	
	return;
}

Promeo.prototype.getVideo = function(id)
{
	var url = '/' + this.lang + '/youtube.html?p=' + id;
	var win = window.open(url, 'youtube', 'top=300,left=300,width=425,height=355');
	win.focus();
	
	return false;
}

Promeo.prototype.quick_validate = function(elements)
{
	var text;
	switch (this.lang)
	{
		default:
		case 'es': text = 'Por favor rellene todos los campos.';  break;
		case 'de': text = 'Bitte füllen Sie alle Felder aus!';    break;
		case 'fr': 
		case 'en': text = 'Please fill out all fields!';          break;
	}
	
	for (var i = 0; i < 3; i++)
	{
		if (elements[i].value.replace(/ /g, '') == '')
		{
			alert(text);
		
			elements[i].focus();
			return false;
		}
	}
	
	return true;
}


Promeo.prototype.disable_fields = function(disable)
{
	var fields = document.search.getElementsByTagName('input');
	
	for (var i = 1; i < fields.length - 1; i++)
	{
		fields[i].disabled = disable;
	}
}

Promeo.prototype.email = function(alias)
{
	window.location = 'mailto:' + [alias, 'procoim.com'].join('@');
}

Promeo.prototype.set_lang = function(lang)
{
	window.location = window.location.toString().replace(/\/[a-z]{2}\//, '/' + lang + '/');
	return false;
}


function create_req_object()
{
	var req = false;
	
	if (window.XMLHttpRequest)
	{
		req = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		var msp = new Array('Micr' + 'osoft', 'Msx' + 'ml2');
		
		for (var i in msp)
		{
			try
			{
				req = eval('ne' + 'w Act' + 'iveXObj'+ 'ect(msp[i] + ".XMLH'+ 'TTP");');
			}
			catch(e)
			{
				continue;
			}
		}
	}
	
	return req;
}

function getNodeValue(obj, tag)
{
    return fetch_tags(obj, tag).item(0).firstChild.nodeValue;
}


function swdPop(URL, Name, Features) 
{
	window.open(URL, Name, Features).focus();
	return false;
}


function totop()
{
	if (window.scroll)
	{
		window.scroll(0, 0);
		return false;
	}
	
	return true;
}


function set_fontsize(object, size)
{
	fetch_obj(object).style.fontSize = size + 'px';
}


function swdURL(urlid)
{
	window.open('links.html?lid='+ urlid, urlid, '').focus();
	return false;
}


function toggle_layer(id)
{
	var div = fetch_obj(id).style;
	div.display = div.display == 'none' ? 'block' : 'none';
	
	return false;
}


function fetch_obj(obj)
{
	if (document.getElementById)
	{
		return document.getElementById(obj);
	}
	else if (document.all)
	{
		return document.all[obj];
	}
	else if (document.layers)
	{
		return document.layers[obj];
	}
	else
	{
		return new Array();
	}
}


function fetch_tags(obj, tag)
{
	if (document.getElementsByTagName)
	{
		return obj.getElementsByTagName(tag);
	}
	else if (document.all && document.all.tags)
	{
		return obj.all.tags(tag);
	}
	else
	{
		return new Array();
	}
}


function confirm_reset_fields(text)
{
	return confirm(text) ? reset_fields() : false;
}

/**
*	Necessary if form was submitted unsuccesfully.
*/
function reset_fields()
{
	var fields = document.getElementsByTagName('input');
	
	for (i = 0; i < fields.length; i++)
	{
		if (fields[i].type == 'text')
			fields[i].value = '';
	}
	
	return false;
}
	
	
	