function makeRequest(file,obj){
var xmlObj = null;
if(window.XMLHttpRequest)
	{
      xmlObj = new XMLHttpRequest();
  } 	else if(window.ActiveXObject){
      xmlObj = new ActiveXObject("Microsoft.XMLHTTP");
  } 
  else 
  {
      return;
  }
  
xmlObj.onreadystatechange = function()
{
    if(xmlObj.readyState == 4)

{
    var result = xmlObj.responseText
    updateObj(obj, result);
}

}
    
document.getElementById(obj).innerHTML="<center><img src=yukleniyor.gif>&nbsp;Sayfa Getiriliyor...<center>";


xmlObj.open ("GET", file, true);
xmlObj.send ("");
}
function updateObj(obj, data)
{
	document.getElementById(obj).innerHTML=data;
}


function Getentry()
{
var eleman = document.getElementById('baslikekle').value;
var page = 'baslikquery.asp?query=' + eleman;
makeRequest(page,'baslik_result');
}


function GetQuery()
{
var eleman = document.getElementById('query').value;
var page = 'aramaquery.asp?query=' + eleman;
makeRequest(page,'query_result');
}

function addFavorite(yid, bid){
makeRequest('durum.asp?islem=f1&yid='+yid+'&baslik='+bid,'favoriler');
makeRequest('favoriler.asp','favoriler');
	}

function delFavorite(yid){
makeRequest('durum.asp?islem=f1sil&id='+yid,'favoriler');
makeRequest('favoriler.asp','favoriler');
	}


//*************** Puan Sistemi
function xmlPost(url,text)
{
var xmlspan = document.getElementById(text);
var xmlhttp = new_xmlhttp();
xmlhttp.open("get",url,true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=iso-8859-9");
xmlhttp.send(text);
xmlhttp.onreadystatechange = function() {

if (xmlhttp.readyState == 1) 
       {xmlspan.innerHTML = 'Puan Ekleniyor...'}

if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
       {xmlspan.innerHTML = xmlhttp.responseText}
else
       {xmlspan.innerHTML = 'Hatalý Ýstek'}
}

return false;
}

function new_xmlhttp()
{
	var xmlhttp;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	  try {
	  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp=false;
	  }
	 }
	@else
	 xmlhttp=false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	 try {
	  xmlhttp = new XMLHttpRequest();
	 } catch (e) {
	  xmlhttp=false;
	 }
	}
	return xmlhttp;
}



//*************** Soultip

var divname="soultip";
var divInnername="soultipinner";

/*If this is true tooltips will not move and shown in fixed mode*/
var fixed=false;

/*-----------------------------
Customizable Soultip HTML Code
soultip is the name of main holder;
soultipinner is the place for help;

So you may add your own static headers to id="soultip" div. Do not forget "soultipinner" has dynamic content.
-----------------------------*/
var soultip="<div id='soultip'><div id='soultipinner'></div></div><link href='text1.css' rel='stylesheet' type='text/css' />"

// -- END OF Customizations;
/****************************************************************************************/


// Fix SoulTip Coordinates
var CoordLeft=10;
var CoordRight=-15;

//* For Storing hidden selects
var hiddenTags = new Array();

function fm_MXY(XorY){ // Mouse Coords
	var coord = 0;
	XorY=="x"?coord = event.clientX + document.body.scrollLeft:coord = event.clientY + document.body.scrollTop;
	if(coord<0)coord=0;
	return coord;
}

function fm_help(){ // Show-Hide 
	var NewCoordLeft=0,NewCoordRight=0; 
	var d=document;
	var thisObj = d.getElementById(divname); // findObj
	var browserwidth=document.body.clientWidth; // Browser sizes - Positions
	var browserheight=document.body.clientHeight+document.body.scrollTop+25;
	var soulwidth=thisObj.offsetWidth+10, soulheight=thisObj.offsetHeight+10; // Soultip sizes

	var activeObj=window.event.srcElement; // Active Object
	var desc=activeObj.help; //help tag
	
	if(desc!=null){	//If object help tag exist
		var x = fm_MXY("x"), y = fm_MXY("y");
		if(document.alldesc==desc){	//If fixed
			NewCoordLeft=activeObj.offsetLeft+activeObj.offsetWidth-x;
			NewCoordRight=activeObj.offsetTop-y;
		}

		NewCoordLeft+=(x+soulwidth>browserwidth)?-soulwidth:CoordLeft;
		NewCoordRight+=(y+soulheight>browserheight)?-soulheight:CoordRight;

		thisObj.style.left=x+NewCoordLeft+"px"; //Move X 
		thisObj.style.top=y+NewCoordRight+"px"; //Move Y

		fm_writehelp(desc);
		hy_collusion(thisObj);
		
		if(fixed)document.alldesc=desc;
	
	}else{
		hy_collusionRecover();
		thisObj.style.display="none";
	}
}

function fm_writehelp(val){
	var d=document;
	var thisObj = d.getElementById(divname);
	var innerObj = d.getElementById(divInnername);
	innerObj.innerHTML=val;
	thisObj.style.display="block";	
}

function hy_collusion(obj){
	var offsetLeft   = obj.offsetLeft;
	var offsetTop    = obj.offsetTop;
	var offsetWidth  = obj.offsetWidth;
	var offsetHeight = obj.offsetHeight;
	
	var topLeftX     = offsetLeft;
	var topLeftY     = offsetTop;
	var bottomRightX = offsetLeft + offsetWidth;
	var bottomRightY = offsetTop  + offsetHeight;
	var hyl = 0;
	
	if(document.getElementsByTagName){
		var selectTags = document.getElementsByTagName("select");
		
		for( ; hyl < selectTags.length; hyl++){
			var tag = selectTags[hyl];											
			var x1 = tag.offsetLeft;
			var y1 = tag.offsetTop;
			var x2 = x1 + tag.offsetWidth;
			var y2 = y1 + tag.offsetHeight;
			
			if( ((topLeftX < x1 && x1 < bottomRightX) || (topLeftX < x2 && x2 < bottomRightX)) &&
				((topLeftY < y1 && y1 < bottomRightY) || (topLeftY < y2 && y2 < bottomRightY)) ) {
			
				tag.style.visibility = "hidden";
				hiddenTags[ hiddenTags.length ] = tag;			
			}	
			else
				tag.style.visibility = "visible";
		}		
	}
}
function hy_collusionRecover(){
	var hyl = 0;
	
	for( ; hyl<hiddenTags.length; hyl++)
		hiddenTags[hyl].style.visibility = "visible";
}

// ACTION | Grab mousemove and Write Soultip
if(document.all){
	document.write(soultip);
	document.onmousemove=fm_help;
}

//*************** Soultip Bitti

function openCH(ch)
{
ch = 'query.asp?id=' + ch + '&sCode=2BA1056B1A10559F'
makeRequest(ch ,'TV','GET')
}
