var Browser  = navigator.userAgent.toLowerCase();
var Explorer = Browser.indexOf("msie")       != -1;
var Firefox  = Browser.indexOf("firefox")    != -1;
var Opera    = Browser.indexOf("opera")      != -1;
var Safari   = Browser.indexOf("safari/312") != -1;

function WriteMail(Name,Domain,Suffix,Text) {
	if(!Name || !Domain || !Suffix) {
		return false;
	}
	
	var eMail = Name + "\u0040" + Domain + "." + Suffix;
	
	if(!Text) {
		Text = eMail;
	}
	
	document.write("<a href=\"mailto:" + eMail + "\" title=\"" + eMail + "\">" + Text + "<\/a>");
}

function BigFont(Obj) {
	var Dom = findDOM(Obj,1);
	var FontSize;
	
	if(!Dom.fontSize) {
		FontSize = 11;
	} else {
		FontSize = Dom.fontSize.substring(0,Dom.fontSize.length - 2);
	}
	
	if(FontSize == 14) {
		return false;
	}
	
	FontSize++;
	
	return Dom.fontSize = FontSize + "px";
}

function SmallFont(Obj) {
	var Dom = findDOM(Obj,1);
	var FontSize;
	
	if(!Dom.fontSize) {
		FontSize = 11;
	} else {
		FontSize = Dom.fontSize.substring(0,Dom.fontSize.length - 2);
	}
	
	if(FontSize == 8) {
		return false;
	}
	
	FontSize--;
	
	return Dom.fontSize = FontSize + "px";
}

function CellColor(Row,bgColor,fgColor) {
	var Cells,CellCount,i;
	
	if(typeof(document.getElementsByTagName) != "undefined") {
		Cells = Row.getElementsByTagName("td");
	} else if(typeof(Row.cells) != "undefined") {
		Cells = Row.cells;
	} else {
		return false;
	}
	
	for(i = 0;i < Cells.length;i++) {
		Cells[i].style.backgroundColor = bgColor;
		Cells[i].style.color = fgColor;
	}
	
	return true;
}

function CountChars(Obj,Max) {
	if(Obj.value.length > Max) {
		alert("En fazla " + Max + " karakter yazabilirsiniz.");
		Obj.value = Obj.value.substring(0,Max);
		return false;
	}
	
	return true;
}

function PopUp(Url,Width,Height,Toolbar,Scrollbars,Location,Status,Menubar,Resizable) {
	Width  = Width  + 50;
	Height = Height + 50;
	
	var PopUp = window.open("","","width=" + Width + ",height=" + Height + ",left=" + ((screen.width - Width) / 2)+ ",top=" + ((screen.height - Height) / 4) + ",toolbar=" + Toolbar + ",scrollbars=" + Scrollbars + ",location=" + Location + ",status=" + Status + ",menubar=" + Menubar + ",resizable=" + Resizable);
	
	with(PopUp) {
		document.open();
		document.location.href = Url;
		document.close();
		focus();
	}
	
	return true;
}
