function largerText() {
	var f = document.getElementById("c");
	if(f.style.fontSize.length == 0) { f.style.fontSize = "100%"; }
	if((f.style.fontSize.substring(-1, f.style.fontSize.length-1)*1) < 130) {
		f.style.fontSize = (f.style.fontSize.substring(-1, f.style.fontSize.length-1)*1) + 10 + "%";
	}
}
function smallerText() {
	var f = document.getElementById("c");
	if(f.style.fontSize.length == 0) { f.style.fontSize = "100%"; }
	if((f.style.fontSize.substring(-1, f.style.fontSize.length-1)*1) > 80) {
		f.style.fontSize = (f.style.fontSize.substring(-1, f.style.fontSize.length-1)*1) - 10 + "%";
	}
}

function POP(url, width, height, scrollbars) {
	height = height+15;
	width = width+28;
	p = window.open(url, "PPop" + (Math.round((Math.random()*9)+1)), "width=" + width + ",height=" + height + ",left=175,top=175, scrollbars=" + scrollbars);
	p.focus();
}

function discuss(i) {
	window.open("http://forum.arkitera.com/showthread.php?t=" + i);
}

var xpos = 0;
var Id = 0;
var Idc = 0;
function openSponsorAd() {
	if(!Id && document.getElementById("sponsorAdContainer").style.height != "120px"){ 
		document.getElementById("sponsorAdContainer").style.visibility = "visible";
		document.getElementById("sponsorAdContainer").style.height = "120px";
//		slideOutSponsorAdContainer();
		xpos=0;
	}
	Idc = window.setTimeout("closeSponsorAd();",6000);
}
/*
function openSponsorAdSuper() {
	var a = document.getElementById("sponsorAdContainerSuper");
	a.style.display = "inline";
}
*/

function closeSponsorAd() {
	if(!Id && document.getElementById("sponsorAdContainer").style.height != "1px"){
		document.getElementById("sponsorAdContainer").style.visibility = "hidden";
		document.getElementById("sponsorAdContainer").style.height = "1px";
		//slideInSponsorAdContainer();
	}
	window.clearTimeout(Idc);Idc=0;
}
/*
function closeSponsorAdSuper() {
	var a = document.getElementById("sponsorAdContainerSuper");
	a.style.display = "none";
}
*/
function slideOutSponsorAdContainer(){
	xpos=xpos + 10;
	document.getElementById("sponsorAdContainer").style.height=xpos + "px";
	if (xpos >= 120){ window.clearTimeout(Id);Id=0; }
	else{ Id = window.setTimeout("slideOutSponsorAdContainer();",1); }
} // <end> slideOutSponsorAdContainer()

function slideInSponsorAdContainer(){
	xpos=xpos-10;
	document.getElementById("sponsorAdContainer").style.height=xpos+"px";
	if (xpos == 0){ window.clearTimeout(Id);Id=0; }
	else{ Id = window.setTimeout("slideInSponsorAdContainer();",1); }
} // <end> slideInSponsorAdContainer

function checkToValidate(f) {
	var inputEnum = f.getElementsByTagName("input");
	var notValidatedFields = new Array();
	for(i=0;i<inputEnum.length;i++) { // Loop thru the input fields
		if ((inputEnum[i].type == "text" || inputEnum[i].type == "password") && inputEnum[i].getAttribute("checkToValidate") != null) { // Applicable fields
			cSet = inputEnum[i].getAttribute("checkToValidate").split(";");
			if(cSet[0] == "text" && inputEnum[i].value.length < cSet[1]) { notValidatedFields.push(cSet[2]); continue; }
			if(cSet[0] == "email" && !isEmail(inputEnum[i].value)) { notValidatedFields.push(cSet[2]); continue; }
			if(cSet[0] == "alphanumeric" && (!isAlphaNumeric(inputEnum[i].value) || inputEnum[i].value.length < cSet[1])) { notValidatedFields.push(cSet[2]); continue; }
			if(cSet[0] == "match" && inputEnum[i].value != document.getElementById(cSet[1]).value) { notValidatedFields.push(cSet[2]); continue; }
			if(cSet[0] == "numeric" && (isNaN(inputEnum[i].value) || inputEnum[i].value == 0 || inputEnum[i].value.length < cSet[1])) { notValidatedFields.push(cSet[2]); continue; }
		} // if()
	} // for()
	var inputEnum = f.getElementsByTagName("select");
	for(i=0;i<inputEnum.length;i++) { // Loop thru the input fields
		if (inputEnum[i].getAttribute("checkToValidate") != null) { // Applicable fields
			cSet = inputEnum[i].getAttribute("checkToValidate").split(";");
			if(inputEnum[i].options[inputEnum[i].selectedIndex].value == '') { notValidatedFields.push(cSet[2]); }
		} // if()
	} // for()
	var inputEnum = f.getElementsByTagName("textarea");
	for(i=0;i<inputEnum.length;i++) { // Loop thru the input fields
		if (inputEnum[i].getAttribute("checkToValidate") != null) { // Applicable fields
			cSet = inputEnum[i].getAttribute("checkToValidate").split(";");
			if(inputEnum[i].value.length < cSet[1]) { notValidatedFields.push(cSet[2]); }
		} // if()
	} // for()
	if(notValidatedFields.length != 0) { alert("Formunuzda boş ya da hatalı alanlar var:\n\n" + unique(notValidatedFields).join("\n")); return false; }
} // checkToValidate()
function unique(a) {
	tmp = new Array(0);
	for(i=0;i<a.length;i++){
		if(!doesContain(tmp, a[i])){ tmp.length+=1; tmp[tmp.length-1]=a[i]; }
	} // <end> for
	return tmp;
} // <end> unique
function doesContain(a, e) {
	for(j=0;j<a.length;j++)if(a[j]==e)return true;
	return false;
} // <end> contains

function isEmail(str){
	if(isEmpty(str)) return false;
	var re = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i
	return re.test(str);
}
function isAlpha(str){
	var re = /[^a-zA-Z]/g
	if (re.test(str)) return false;
	return true;
}
function isNumeric(str){
	var re = /[\D]/g
	if (re.test(str)) return false;
	return true;
}
function isAlphaNumeric(str){
	var re = /[^a-zA-Z0-9]/g
	if (re.test(str)) return false;
	return true;
}
function isEmpty(str){
	return (str == null) || (str.length == 0);
}
function isLength(str, len){
	return str.length == len;
}
function isLengthBetween(str, min, max){
	return (str.length >= min)&&(str.length <= max);
}
// (000)000-0000, (000) 000-0000, 000-000-0000, 000.000.0000, 000 000 0000, 0000000000
function isPhoneNumber(str){
	var re = /^\(?[2-9]\d{2}[\)\.-]?\s?\d{3}[\s\.-]?\d{4}$/
	return re.test(str);
}
// returns true if the string is a valid date formatted as...
// mm dd yyyy, mm/dd/yyyy, mm.dd.yyyy, mm-dd-yyyy
function isDate(str){
	var re = /^(\d{1,2})[\s\.\/-](\d{1,2})[\s\.\/-](\d{4})$/
	if (!re.test(str)) return false;
	var result = str.match(re);
	var m = parseInt(result[1]);
	var d = parseInt(result[2]);
	var y = parseInt(result[3]);
	if(m < 1 || m > 12 || y < 1900 || y > 2100) return false;
	if(m == 2){ var days = ((y % 4) == 0) ? 29 : 28; }
	else if(m == 4 || m == 6 || m == 9 || m == 11) { var days = 30; }
	else{ var days = 31; }
	return (d >= 1 && d <= days);
}
function isMatch(str1, str2){
	return str1 == str2;
}
function hasWhitespace(str){ // NOT USED IN FORM VALIDATION
	var re = /[\S]/g
	if (re.test(str)) return false;
	return true;
}
function getArchive(action,id,year,file) {
	location.href = "/" + file + ".php?action=" + action + "&ID=" + id + "&year=" + year + "&order=1";
}