var ajax = new AJAXHandler();
function getHostingInfo(plan)
{
	switch (plan)
	{
		case 'personal':
			get('hosting-standard').style.display = 'none';
			get('hosting-classic').style.display = 'none';
			break;
		case 'standard':
			get('hosting-personal').style.display = 'none';
			get('hosting-classic').style.display = 'none';
			break;
		case 'classic':
			get('hosting-personal').style.display = 'none';
			get('hosting-standard').style.display = 'none';
			break;
	}
	get('hosting-' + plan).style.display = 'block';
}

function gallerySearch()
{
	get('gallery-home').style.display = 'none';
	get('gallery-search').style.display = 'block';
	get('gallery-login').style.display = 'none';
}

function galleryLogin()
{
	get('gallery-home').style.display = 'none';
	get('gallery-search').style.display = 'none';
	get('gallery-login').style.display = 'block';
}

function validateGallerySearch()
{
	if (!trim(get('gallery-name').value))
	{
		alert('Ingresa un usuario o parte del mismo.');
		return false;
	}
	return true;
}

function validateGalleryLogin(galleryUrl)
{
	if (!trim(get('username').value) || !trim(get('password').value))
	{
		alert('Debes ingresar tu nombre de usuario y contraseņa');
		return false;
	}
	return true;
}
/*========================================================================*/

function HelpMail(page) {
	OpenWin = this.open(page, "AyudaWebmMail", ["toolbar=no,menubar=no,location=no,scrollbars=yes,resize=yes,height=350,width=520"]);
}

standard = new Image;
unsecure = new Image;
secure = new Image;
highlysecure = new Image;

standard.src = "http://imagenes.argentina.com/newhome/images/default.gif";
unsecure.src = "http://imagenes.argentina.com/newhome/images/bajo.gif";
secure.src = "http://imagenes.argentina.com/newhome/images/medio.gif";
highlysecure.src = "http://imagenes.argentina.com/newhome/images/alto.gif";


function ChangePicture(PicName, PicObject) {

	window.document.images[PicName].src = PicObject.src;

}
function checkNumber(){
	var captcha = document.registrar.imgvalid.value;
	var reg=/\d$/g;
//alert(captcha);
	if(!reg.test(captcha)){
  		alert('mal')
	}

}

function checkInput() {
	var TestNumberOfChars = false;
	var TestUppercaseChars = false;
	var TestLowercaseChars = false;
	var TestDigits = false;
	var TestSpecialChars = false;
	var TestCounter = false;
	var TestWhiteSpaces = false;
	var TestSecondPassword = false;
	var counter = 0;
	hilfe = window.document.registrar.passwd.value;
	
	/* Check if the password contains any words from personal data */
	testhilfe = hilfe.toLowerCase();
	/* Check if length of password is greather then 8 */
	
	if(hilfe.length >= 8) {
		if(!TestNumberOfChars) {		// do it only if the counter is 8, if it's greather, the TestNumberOfChars will be true and the right image is shown
			TestNumberOfChars = true;
		}
	} else {
		TestNumberOfChars = false;
	}
	
	/* Check for minimum of 2 uppercase Letters */
	if(hilfe.match(/[A-Z].*[A-Z]/)) {
		TestUppercaseChars = true;
	} else {
		TestUppercaseChars = false;
	}
	
	/* Check for minimum of 2 lowercase letters */
	if(hilfe.match(/[a-z].*[a-z]/)) {
		TestLowercaseChars = true;
	} else {
		TestLowercaseChars = false;
	}

	
	/* Check for minimum of 2 digits */
	if(hilfe.match(/[0-9].*[0-9]/)) {
		TestDigits = true;
	} else {
		TestDigits = false;
	}
	
	
	/* Check for minimum of 2 special chars */
	var specCharCounter = 0;
	if(hilfe.length > 0) {
		characters = hilfe.split("");
		for(var i = 0; i < characters.length; i++) {
			singleChar = characters[i];
			if(singleChar.match(/[^a-zA-Z0-9]/)) {
				specCharCounter++;
			}
		}
		if(specCharCounter >= 2) {
			TestSpecialChars = true;
		} else {
			TestSpecialChars = false;
		}
	}
	
	/* Check for whitespaces and ESC-Sequences */
	if(hilfe.match(/\s/)) {
		TestWhiteSpaces = true;
	} else {
		TestWhiteSpaces = false;
	}
	
	/* Check for minimum of 2 true ifs */
	if(TestUppercaseChars) { counter++;}
	if(TestLowercaseChars) { counter++;}
	if(TestDigits)         { counter++;}
	if(TestSpecialChars)   { counter++;}
	if((counter >= 2) && !TestWhiteSpaces) {
		if(!TestCounter) {
			TestCounter = true;
		}
	} else {
		TestCounter = false;
	}
var zaehler = 0;
if(TestCounter) { zaehler++;}
if(counter == 3) { zaehler++;}
if(TestNumberOfChars) { zaehler++;}

if(zaehler == 0) {
	ChangePicture('seclevel', standard);
}
if(zaehler == 1) {
	ChangePicture('seclevel', unsecure);
}
if(zaehler == 2) {
	ChangePicture('seclevel', secure);
}
if(zaehler == 3) {
	ChangePicture('seclevel', highlysecure);
}
if (zaehler > 0){ return true; }
else { return false; }
	
}

