var lobackimage;
var lobackcolor;
var lotextcolor;
var lostyle	= 0;
var losrc	= 0;
var ox = 0;
var oy = 0;
var scrollArray = new Array();


//----------------------------------------------------------------------------------->>
// Returns a Quot : "
function quot() {
	
	return String.fromCharCode(34);
}

//----------------------------------------------------------------------------------->>
// Mouse hover (button)
function mOvrb(src,clrOver) {

	if (!src.contains(event.fromElement)) {
		src.style.cursor = "hand";
		src.style.background = clrOver;
	}
	
}

//----------------------------------------------------------------------------------->>
// Mouse out (button)
function mOutb(src,clrIn) {

	if (!src.contains(event.toElement)) {
		src.style.cursor = "default";
		src.style.background = clrIn;
	}
		
}

//----------------------------------------------------------------------------------->>
// Mouse click (button)
function mClkb(src, link, target) {

	ws('Lutfen bekleyin..');

	if (window.parent.frames.length != 0) {
			window.open(link, target);
	}
	else {
		window.navigate(link, target);
	}
}

//----------------------------------------------------------------------------------->>
// Mouse hover (class)
function mOvrC(src, st) {

	if (losrc != 0)
		if (lostyle != 0) {
			losrc.className		= lostyle;
			losrc				= 0;
		}

	if (!src.contains(event.fromElement)) {
		lostyle				= src.className;
		losrc				= src;
		src.className		= st;
		src.style.cursor 	= "hand";
	}
	
}

//----------------------------------------------------------------------------------->>
// Mouse out (class)
function mOutC(src, bclrIn, clrIn) {

	if (!src.contains(event.toElement)) {
		if (lostyle != 0) {
			src.className		= lostyle;
			src.style.cursor	= "default";
			lostyle				= 0;
			losrc				= 0;
		}
	}
	
}

//----------------------------------------------------------------------------------->>
// Mouse click (class)
function mClkC(src, target) {

	if (typeof target == "undefined") {
		window.navigate(src);
	}
	else {
		if (target == 0)
			window.parent.navigate(src);
		else
			window.open(src, target);
	}
}

//----------------------------------------------------------------------------------->>
// Write status
function ws(stext, loading) {

	window.status = stext;

	alert(window.parent.frames.footer.document.all.statimg.className);
	if (loading)
		window.parent.frames.footer.document.all.statimg.className = "StatAni";
	else
		window.parent.frames.footer.document.all.statimg.className = "Stat";
	
	return true;
}



//----------------------------------------------------------------------------------->>
// Minimize Window
function mnw() {

	var sw = screen.width;
	var sh = screen.height;

	window.parent.moveTo(sw, sh);
	
	return;
}


//----------------------------------------------------------------------------------->>
// Restore Window
function rew() {

	window.parent.moveTo(0, 0);
	
	return;
}


//----------------------------------------------------------------------------------->>
// Maximize Window
function mxw() {

	window.parent.moveTo(0, 0);
	window.parent.resizeTo(window.parent.screen.availWidth, window.parent.screen.availHeight);
	
	return;
}


//----------------------------------------------------------------------------------->>
// Resize Window
function rsz(wd, he) {

	if (wd > window.screen.availWidth)
		wd = window.screen.availWidth;
	if (he > window.screen.availHeight)
		he = window.screen.availHeight;

	window.parent.resizeTo(wd, he);

	return;
}


//----------------------------------------------------------------------------------->>
// Move window with mouse position
function mwm() {
	

	if (window.event.button == 1) {
		window.moveBy(window.event.screenX - ox, window.event.screenY - oy);
	}

	ox = window.event.screenX;
	oy = window.event.screenY;

	return;
}


//----------------------------------------------------------------------------------->>
// Re-size frame
function szf(fobj) {

	try {
//		fobj.style.width = document.body.scrollWidth;
		fobj.style.height = document.body.scrollHeight + 5;
	}
	catch(e)
	{}
	
	return;
}


//----------------------------------------------------------------------------------->>
// Re-direct page
function rdp(page, timeout, target) {

var code;

	if (typeof target == "undefined")
		code = "window.parent.navigate('" + page + "');";
	else
		code = "window.open('" + page + "', '" + target + "');";
		
	window.setTimeout(code, timeout);
	
	return;
}


//----------------------------------------------------------------------------------->>
// Write status
function ws(stext, loading) {

	var ls = new String();
	try {
		ls = window.parent.frames.footer.document.form2.stbar.value;

		if (ls.substring(0,1) != " ") {
			window.parent.frames.footer.document.form2.stbar.value = stext;
			ls = window.parent.frames.footer.document.form2.stbar.value;
		}
	
		if (!loading)
			window.parent.frames.footer.document.info.className = "Info";
		else
			window.parent.frames.footer.document.info.className = "InfoL";
	}
	catch(e) {
		return false;
	}

	return true;
}


//----------------------------------------------------------------------------------->>
// Clear status
function cs() {
	
	ws("");
	
	return;
}


//----------------------------------------------------------------------------------->>
// Write page load time
function wpl(ttext) {

	try {
		window.parent.frames.footer.document.form2.plbar.value = ttext;
	} catch (e) {
		return false;
	}

	return true;
}


//----------------------------------------------------------------------------------->>
// Adds an option to selection list
function AddOption(sel, val, txt) {

var nOpt = document.createElement("OPTION");

//	window.status = "Sel: " + sel + ", Val: " + val + ", Txt : " + txt;

	sel.options.add(nOpt);
	nOpt.innerText		= txt;
	nOpt.Value		= val;

	return true;
}






//--------------------------------------------------------------------
function WindowRefresh(win) {

	win.location.reload(1);

	return true;
}


//--------------------------------------------------------------------
function WindowGetLocation(obj) {

	return "http://" + obj.location.host + obj.location.pathname;
}


var cobj, cdate;
//--------------------------------------------------------------------
function updateClock(lobj, ldate) {

	if (lobj)	cobj  = lobj;
	if (ldate)	cdate = ldate.toDate();
	
	try {
		cdate.setSeconds(cdate.getSeconds()+1);
		cobj.innerHTML = cdate.toStringEx(1);
	
		window.setTimeout('updateClock()', 1000);
	}
	catch(e) {
		return false;
	}

	return true;
}




//
// SSO JavaScript Object
//
var sso = new function() {


	//---------------------------------------------------->>
	// Form submit
	this.submit = function(obj, form) {

		form.submit();
		obj.disabled = 1;
	}


	//---------------------------------------------------->>
	// Mouse hover (class)
	this.mouseover = function(src, st) {

		if (losrc != 0)
			if (lostyle != 0) {
				losrc.className		= lostyle;
				losrc			= 0;
			}

		if (!src.contains(event.fromElement)) {
			lostyle			= src.className;
			losrc			= src;
			src.className		= st;
			src.style.cursor 	= "hand";
		}
	}


	//---------------------------------------------------->>
	// Mouse out (class)
	this.mouseout = function(src) {

		if (!src.contains(event.toElement)) {
			if (lostyle != 0) {
				src.className		= lostyle;
				src.style.cursor	= "default";
				lostyle			= 0;
				losrc			= 0;
			}
		}
	}


	//---------------------------------------------------->>
	// Navigate To
	this.nav2 = function(href, target) {

		var t = target ? document.getElementById(target) : window;

		try {
			t.location.href = href;
		} catch(e) {
			return t.navigate(href);
		}
	}


	//---------------------------------------------------->>
	// Go Back
	this.goBack = function(src) {

		if (src) src.disabled = true;

		try {
			history.go(-1);
		} catch(e) { }
	}


	//---------------------------------------------------->>
	// Add option (to SELECT list)
	this.addoption = function(src, title, value, index) {

	var opt = document.createElement("OPTION");

		opt.text  = String(title);
		opt.value = String(value);

		return src.add(opt, index);
	}


	//---------------------------------------------------->>
	// Open mini window
	this.openmini = function(ref, size, pos, target) {

	var wh;

		target = target ? target : "_blank";
		sz = size ? ", width=" + size.replace("x", ",height=") : "";
		ps = pos ? ", top=" + pos.replace("x", ",left=") : "";

		optxt = "fullscreen=no, toolbar=no, location=no, directories=no," +
			"status=no, menubar=no, scrollbars=yes, resizable=no" + sz + ps;

		wh = window.open(ref, target, optxt);

		return wh;
	}
	
	//---------------------------------------------------->>
	// Open dialog
	this.opendialog = function(ref, size, pos) {

	var wh, optxt = "";

		if (typeof target == "undefined") target="_blank";

		sz = size.replace("x", ";dialogHeight:");
		ps = size.replace("x", ";dialogLeft:");

		if (pos)
			optxt += "dialogTop:" + ps + ";";
		if (size)
			optxt += "dialogWidth:" + sz + ";";

		wh = window.showModalDialog(ref, null);

		return wh;
	}

	//---------------------------------------------------->>
	// Open full screen window (IE 4.0+)
	this.openfull = function(ref, target, width, height) {

	var wh;

		if (typeof width == "undefined") width = screen.width;
		if (typeof height == "undefined") height = screen.height;
		if (typeof target == "undefined") target="_blank";

		try {
			wh = window.open(ref, target, "fullscreen=yes, scrollbars=no, " +
			"toolbar=no, location=no, directories=no, status=no, " +
			"menubar=no, resizable=no, width=" + width + ", height=" +
			height);
			wh.resizeTo(width, height);
		}
		catch(e) {
			return false;
		}

		return;
	}

	//---------------------------------------------------->>
	this.setqstr = function(Url, pName, pVal) {

	var xUrl = Url ? Url : "";
	var xUrl2, pos, pos2;

		if (!pName) return;

		// Aynı isimli parametre olduğu zaman üzerine yaz..
		pos = xUrl.search(pName);
		if (pos != -1) {
			xUrl2	= xUrl.substring(pos+1, xUrl.length);
			pos2	= xUrl2.search("&");

			xUrl	= xUrl.substring(0, pos-1);

			if (pVal || pVal == 0)
				xUrl += (xUrl ? "&" : "") + pName + "=" + pVal;

			if (pos2 > 0)
				xUrl += xUrl2.substring(pos2, xUrl2.length);
		}
		else
			if (pVal || pVal == 0)
				xUrl += (xUrl ? "&" : "") + pName + "=" + pVal;

		if (xUrl.substr(0,1) == "&")
			xUrl = "?" + xUrl.substr(1);
		if (xUrl.substr(0,1) != "?")
			xUrl = "?" + xUrl;
	
		return xUrl;
	}

	//---------------------------------------------------->>
	this.getCSV = function(str, no) {

	var i, s = String(str);

		for (i=1; i<no; i++) {
			s = s.substr(s.search(";")+1);
		}

		if (s.search(";") == -1)
			return s;
		else
			return s.substr(0, s.search(";"))
	}

	//---------------------------------------------------->>
	this.hideNshow = function(name, bname) {

		try {
			var obj = document.getElementById(name);
			var btn = document.getElementById(bname);

			if (obj.style)
				obj.style.display = (obj.style.display == 'none') ? '' : 'none';

			if (btn)
				btn.className = btn.className.search("_SEL") > 0 ? btn.className.replace("_SEL", "") : btn.className += "_SEL";
				
			return obj;
		} catch(e) { }

	}

	//--------------------------------------------------------------------
	this.refresh = function(win) {
	
		if (win)
			return win.location.reload(1);
		else
			return window.location.reload(1);
	}

	//--------------------------------------------------------------------
	this.checkEmpty = function(elementID, defaultVal) {
		
	var uc = (typeof elementID == "string") ? document.getElementById(elementID) : elementID;
		
			if (!uc) return true;

			if (uc.value == '' || uc.value == defaultVal) {
				uc.className =  'REQUIRED';
				return false;
			}
			else
				uc.className =  '';
			
			return true;
	}

	//--------------------------------------------------------------------
	this.checkEqual = function(element1, element2) {
		
	var uc1 = (typeof element1 == "string") ? document.getElementById(element1) : element1;
	var uc2 = (typeof element2 == "string") ? document.getElementById(element2) : element2;
	
			if (!uc1 || !uc2) return true;

			if (uc1.value != uc2.value) {
				uc1.className =  'REQUIRED';
				uc2.className =  'REQUIRED';
				return false;
			}
			else {
				uc1.className =  '';
				uc2.className =  '';
			}

			return true;
	}

	//--------------------------------------------------------------------
	this.checkNumber = function() {

		for (i in this.checkNumber.arguments.length)
			if (event.keyCode == this.checkNumber.arguments[i])
				return true;

		if ((event.keyCode < 48) || (event.keyCode > 57))
			event.returnValue = false;
	}
	
	//--------------------------------------------------------------------
	this.disableByName = function(name, value, start, count) {
		
		var a = document.getElementsByName(name);
		
		start = start ? start : 0;
		count = count ? start + count : a.length;
		
		for (var i=start; a[i] && i<count; i++)
			a[i].disabled = value;
	}

	//--------------------------------------------------------------------
	this.checked = function(name, value) {

	var o, i, v;

		try {
			if (!name) return false;
			
			o = document.getElementsByName(name);

			for (i=0; i<o.length; i++)
				o[i].checked = (typeof value == "undefined" ? !o[i].checked : value);
		} catch(e) { return false}

		return true;
	}

	//--------------------------------------------------------------------
	this.ischecked = function(name, index) {

	var o, i, rv = false;

		try {
			if (!name) return false;

			o = document.getElementsByName(name);

			if (typeof index != "undefined")
				rv = o[index].checked;
			else
				for (i=0; i<o.length; i++)
					rv |= o[i].checked;
				
		} catch(e) { }

		return rv;
	}
	
	//--------------------------------------------------------------------
	this.scrollFrame = function(name, stepX, stepY) {

		try {
			this.scrollStop(name);
			
			window.frames[name].scrollBy(stepX, stepY);
			scrollArray[name] = setTimeout("sso.scrollFrame('" + name + "', " + stepX + "," + stepY + ")");
		}
		catch(e) { return false; }

		return true;
	}

	//--------------------------------------------------------------------
	this.scrollStop = function(name) {

		try {
			clearTimeout(scrollArray[name]);
		}
		catch(e) { return false; }

		return true;
	}

	//--------------------------------------------------------------------
	this.checkEmail = function(elementID) {
	
	var regEx = new RegExp("^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$");
	var uc = (typeof elementID == "string") ? document.getElementById(elementID) : elementID;
	var rv = false;

		try {
	  	rv = regEx.test(uc.value);

			uc.className = rv ? '' : 'REQUIRED';
		}
		catch(e) { }

		return rv;
	}
		
} //end of SSO object