function resize_iframe()
{
	var height=window.innerWidth;
	if (document.body.clientHeight)
	{
		height=document.body.clientHeight;

	}
	height=height-60;
	if (document.getElementById("glu") != null)
	{
		document.getElementById("glu").style.height=parseInt(height-
		document.getElementById("glu").offsetTop-8)+"px";
	}
}

window.onresize=resize_iframe;

function confirm_delete(loc)
{
	if (confirm("Are you sure you want to delete"))
	{
		self.location=loc;
	}
}

function confirm_edit(loc)
{
	self.location=loc;
}

function createRequestObject()
{
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer")
	{
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		ro = new XMLHttpRequest();
	}
	return ro;
}

var http = createRequestObject();

function sndAccess(action)
{
	document.getElementById("");

	http.open('post', 'include/ajax.php?action='+action);
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function sndReq(action)
{
	http.open('get', 'ajax.php?action='+action);
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function handleResponse()
{
	if(http.readyState == 4)
	{
		var response = http.responseText;
		var update = new Array();

		if(response.indexOf('|' != -1))
		{
			update = response.split('|');
			document.getElementById(update[0]).innerHTML = update[1];
		}
	}
}

//windowu ortaliyorum
dom = (document.getElementById) ? true : false;
ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
ns4 = (document.layers && !dom) ? true : false;
ie4 = (document.all && !dom) ? true : false;
nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

//detect browser
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

function modelesswin(url, mwidth, mheight)
{
	if (document.all&&window.print)
	{ //if ie5
		eval('window.showModelessDialog(url,"","help:0;resizable:1;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")');
	}
	else
	{
		eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=1,scrollbars=1")');
	}
}

function openWin(name,wid,hei,sbar,title)
{
	if (document.all&&window.print)
	{ //if ie5
		eval('window.showModelessDialog(name, title,"help:0;resizable:'+sbar+';dialogWidth:'+wid+'px;dialogHeight:'+hei+'px")');
	}
	else
	{
		xx=screen.availWidth/2-wid/2;
		yy=screen.availHeight/2-hei/2;
		str="left=" + Math.round(xx) + ",top=" + Math.round(yy);
		eval('window.open(name, title, "width='+wid+'px,height='+hei+'px,resizable='+sbar+',scrollbars='+sbar+','+str + '")');
	}
}

function show(movlay)
{
	myObj = document.getElementById(movlay);
	if (myObj != null)
	{
		myObj.style.display='';
	}
}

function hide(movlay)
{
	myObj = document.getElementById(movlay);
	if (myObj != null)
	{
		myObj.style.display='none';
	}
}

function construction()
{
	alert("You dont have an access for this section");
}

//---Window netscape e gore resize ediyorum
function MM_reloadPage(init)
{  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4))
	{
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }
	}
	else
	{
		if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
}
MM_reloadPage(true);

function updateParent(newURL)
{
	opener.document.location = newURL
}

function clearText(thefield)
{
	if (thefield.defaultValue==thefield.value)
	{
		thefield.value = "";
	}
}

function checkrequired(which)
{
	var pass=true;
	if (document.images)
	{
		for (i=0;i<which.length;i++)
		{
			var tempobj=which.elements[i];
			if (tempobj.name.substring(0,8)=="required")
			{
				//---added
				if (tempobj.defaultValue==tempobj.value)
				{
					tempobj.value = "";
				}
				//-----------
				if (((tempobj.type=="text" ||tempobj.type=="textarea") && tempobj.value=='')
					||(tempobj.type.toString().charAt(0)=="s"&& tempobj.selectedIndex==0))
				{
					pass=false;
					break;
				}
			}
		}
	}
	if (!pass)
	{
		shortFieldName=tempobj.name.substring(8,30).toUpperCase();
		alert("Please make sure the "+shortFieldName+" field was properly completed.");
		return false;
	}
	else
	return true;
}

