// JavaScript Document
function showScreenshots(number)
{
	number = parseInt(number);
	var screenShotPath = "/img/screenshots/";
	Slimbox.open( [ [screenShotPath + "screenshot-gallery-1.jpg", ""], [screenShotPath + "screenshot-gallery-2.jpg", ""], [screenShotPath + "screenshot-gallery-3.jpg", ""], [screenShotPath + "screenshot-gallery-4.jpg", ""], [screenShotPath + "screenshot-gallery-5.jpg", ""],[screenShotPath + "screenshot-gallery-6.jpg", ""],[screenShotPath + "screenshot-gallery-7.jpg", ""],[screenShotPath + "screenshot-gallery-8.jpg", ""] ], number );
}
function showIndexScreenshots(number)
{
	number = parseInt(number);
	var screenShotPath = "/img/screenshots/";
	Slimbox.open( [ [screenShotPath + "screenshot-index-1.jpg", ""], [screenShotPath + "screenshot-index-2.jpg", ""], [screenShotPath + "screenshot-index-3.jpg", ""], [screenShotPath + "screenshot-index-4.jpg", ""] ], number  );
}
function showWallpapers(number)
{
	number = parseInt(number);
	var wallPaperPath = "/img/wallpapers/";
	Slimbox.open( [ [wallPaperPath + "wallpaper-1.jpg", ""],[wallPaperPath + "wallpaper-2.jpg", ""],[wallPaperPath + "wallpaper-3.jpg", ""],[wallPaperPath + "wallpaper-4.jpg", ""],[wallPaperPath + "wallpaper-5.jpg", ""],[wallPaperPath + "wallpaper-6.jpg", ""],[wallPaperPath + "wallpaper-7.jpg", ""],[wallPaperPath + "wallpaper-8.jpg", ""] ], number );
}
function submitEnter(e, form)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	if (keycode == 13)
	{
		document.forms[form].submit();
		return false;
	}
	else
		return true;
}
function setCookie(name,value,expiredays) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

// check pws for valid characters
function hasValidChar(strPass) {
	// check if str contains special characters
	var only_this = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.$!;:-_#';
	for (var i=0;i<strPass.length;i++) {
		if (only_this.indexOf(strPass.charAt(i))<0) return false;
	}
	return true;
}

// check for secure pwd
function checkPass(strPass,minLen) {
	var sec = 0;
	var check = 98;
	var steps = 6;
	var checkByStep = check / steps;

	var strToCheck = '0123456789'; // check if numbers
	if (contains(strPass, strToCheck)) { sec++ }
	strToCheck = 'abcdefghijklmnopqrstuvwxyz'; // check if lowercase letters
	if (contains(strPass, strToCheck)) { sec++ }
	strToCheck = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // check if uppercase letters
	if (contains(strPass, strToCheck)) { sec++ }
	strToCheck = '.$!;:-_#'; // check if uppercase letters
	if (contains(strPass, strToCheck)) { sec++ }

	// check if at least one uppercase AND one lowercase AND one number
	if (strPass.length < 5) sec = 0;
	if (strPass.length >= 5) sec++;
	if (strPass.length >= 8) sec++;
	if (strPass.length >= 12) sec++;

	var nCount = sec * checkByStep;

	if (nCount > check) nCount = check;

	return Math.ceil(nCount);
}
// check if string in pattern
function contains(strText, strPattern) {
	for (i = 0; i < strText.length; i++) {
		if (strPattern.indexOf(strText.charAt(i)) > -1) return true;
	}
	return false;
}
