var _BROWSER=new Object()
_BROWSER.name=navigator.appName; 

var prefixPath="";
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
} 
function showMap(map_server_address,point_id)
{
	popup(map_server_address +'/pntview.jsp?PointId='+point_id,'sendFriend',550,800);
}
function findPosYpos(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
	 
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else 
		if (obj.y)
			curtop += obj.y;
	return curtop;
}
 
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };
var k=0;
var imageOverLeftPos="100px"
if(__PORTAL_ID==2)
imageOverLeftPos="120px"
function showBigImg(img,tg)
{
		posY=findPosYpos(tg);
		img='<img src="'+imgPaths[0]+"_th_4/"+img+'">';
		if(idiv=document.getElementById('popUpImageDiv'))
		{
			idiv.style.top=posY+"px";
			idiv.innerHTML=img
		}
		else
		{
			divForImage=document.createElement("div");
			divForImage.style.position="absolute";
			//divForImage.style.marginTop="-100px";
			divForImage.style.marginLeft=imageOverLeftPos;
			divForImage.style.padding="3px";
			divForImage.style.display="none";
			divForImage.id="popUpImageDiv";
			divForImage.style.top=posY+"px";
			divForImage.innerHTML=img			
			ifrForAlert=document.body.appendChild(divForImage);
		}
	 	showDiv(tg)
}
function showDiv(tg)
{
	if(document.getElementById('popUpImageDiv'))
		document.getElementById('popUpImageDiv').style.display="inline";
}
function hideBigImg(tg)
{
	
		if(document.getElementById('popUpImageDiv'))
			document.getElementById('popUpImageDiv').style.display="none";
}

function showBigLastImg(img,tg)
{
	if(img!="")
	{
	 img='<div style=\'position:absolute;margin-top:-75px;margin-left:110px;padding:5px;border:1px solid #efefef;background-color:#E1E1E1\'><img style="margin:0px;padding:0px" src="'+imgPaths[0]+"_th_2/"+img+'"></div>';
	 divs=tg.getElementsByTagName('div');
	  
	 if(!divs||divs.length==0)
	 {
	 	tg.innerHTML+=img
	 	
	 }
	 divs[0].style.display="inline"
	}
	 
}
function hideLastImg(tg)
{
	
	divs=tg.getElementsByTagName('div');
	if(divs.length>0)
	{
		divs[0].style.display="none"
	}
}

function popup(url,windowName,height,width,scrollbars)
{
	if(scrollbars == ''){
		
		scrollbars='no';	
	}
	
	newwindow=window.open(url,windowName,"width="+width+",height="+(height+50)+",location=no,scrollbars="+scrollbars);
	
	if (window.focus)
	{
		newwindow.focus()
	}
	return false;
}
function popup2(url,windowName,height,width,scrollbars)
{
	if(scrollbars == ''){
		
		scrollbars='no';	
	}
	
	newwindow=window.open(url,windowName,"width="+width+",height="+(height+50)+",location=no,scrollbars="+scrollbars);
	
	if (window.focus)
	{
		newwindow.focus()
	}
	 
}
function VOID()
{
}
	var pageLoadComplete="loading"

function loadComple()
{
	pageLoadComplete="complete"
}
function showHideBox(theName)
{
	if(!document.getElementById(theName))
		return;
	if (document.getElementById(theName).style.display == 'none')
	{
		document.getElementById(theName).style.display = '';
	}
	else
	{
		document.getElementById(theName).style.display = 'none';
	}
}
function explodeArray(item,delimiter) {
  tempArray=new Array(1);
  var Count=0;
  var tempString=new String(item);

  while (tempString.indexOf(delimiter)>0) {
    tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
    tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); 
    Count=Count+1
  }

  tempArray[Count]=tempString;
  return tempArray;
}
function addEvent(elm, evType, fn, useCapture) 
// addEvent and removeEvent
// cross-browser event handling for IE5+,  NS6 and Mozilla
// By Scott Andrew
{
 if (elm.addEventListener){
   elm.addEventListener(evType, fn, useCapture);
   return true;
 } else if (elm.attachEvent){
   var r = elm.attachEvent("on"+evType, fn);
   return r;
 }
}
addEvent (window,'load',loadComple)
var imgPaths=Array();
var urlType="http://";
imgPaths[0]=urlType+CONFIG_IMG_PATH+"/_thumbnail/"
imgPaths[1]=urlType+CONFIG_IMG_PATH+"/_upload/"
imgPaths[2]=urlType+CONFIG_IMG_PATH+"/userPhoto/"
imgPaths[3]=urlType+CONFIG_IMG_PATH+"/companyLogo/"
imgPaths[4]=urlType+CONFIG_IMG_PATH+"/project/project_images/project_window_banner/"
imgPaths[5]=urlType+CONFIG_IMG_PATH+"/project/project_images/project_logo/"
imgPaths[6]=urlType+CONFIG_IMG_PATH+"/homepage/homepage_images/homepage_header/"
imgPaths[8]=urlType+CONFIG_IMG_PATH+"/project/project_images/builder_logo/"
imgPaths[9]=urlType+CONFIG_IMG_PATH+"/window_image/"
imgPaths[7]="/template/templateType_2/"
imgPaths[10]=urlType+CONFIG_IMG_PATH+"/project/project_images/project_full_banner/"
imgPaths[11]=urlType+CONFIG_IMG_PATH+"/project/project_images/sticky_banner/"
imgPaths[12]=urlType+CONFIG_IMG_PATH+"/cms_image";
imgPaths[13]=urlType+CONFIG_IMG_PATH+"/homepage/gallery_images";

function showAdvertiseImg(addTable,id,imgPath)
{
	
	if(document.getElementById(addTable)){
		 
		if(!imgPath)
			 imgPath=0
		var elem=document.getElementById(addTable).getElementsByTagName('img');
		for(i=0;i<elem.length;i++)
		{
			//alert(imgPaths[imgPath]+elem[i].title)
			if(elem[i].getAttribute('id')==id)
			if(elem[i].attributes.ptitle&&elem[i].attributes.ptitle!="")
			{

				elem[i].src=imgPaths[imgPath]+elem[i].attributes.ptitle.value;

			}			 
				
		}
	}

}


var shopWindow = new Array();

function sendShopWindow()
{
	var i=0;
	var urlStr="?d=1";
	for(i=0;i<shopWindow.length;i++)
	{
		urlStr=urlStr+'&swid[]='+shopWindow[i];
	}	
	try
	{
		var head = document.getElementsByTagName('body').item(1);		
		script = document.createElement('script');
		scriptUrl="/hit/hitShopWindow.php"+urlStr;
		
		script.src = scriptUrl;
		script.type = 'text/javascript';
		script.defer = true;
		script.id = 'lastLoadedCmds';
				
		void(head.appendChild(script));
	}
	catch(ex)
	{
		
	}
	finally
	{
		
	};
}

/**********************************************/

function showQuestionDiv( obj ) { 
	
	next = obj.nextSibling;
	prev = obj.previousSibling.previousSibling;
	if(prev==null)
	prev=obj.parentNode
	obj.style.cursor = "pointer";
	if ( next.style.display == "block" ) {
		next.style.marginLeft = ( navigator.appName == "Microsoft Internet Explorer" ) ? 3 : ( prev.offsetWidth + 20 )
		next.style.display = "none";
	} else {
		next.style.display = "block"
	}
}

function changeBg( obj ) {
	obj.style.backgroundColor = obj.style.backgroundColor == "" ? "#f5f5f5" : "";
	obj.style.cursor = obj.style.cursor == "" ? "pointer" : "";
}
var IFrameObj;
function createIframe(id,name)
{
  if (!document.createElement)
   {
   	return true
   };
  var IFrameDoc;
 
  if (!IFrameObj && document.createElement) {
    
   try {
   	 iframeHTML='\<div style="display:none;height:0px;width:0px;position:absolute;"><iframe id="'+id+'" name="'+name+'" style="';
      iframeHTML+='border:0px;';
      iframeHTML+='width:0px;z-index:-1';
      iframeHTML+='height:0px;position:absolute;display:none';
      iframeHTML+='"><\/iframe></div>';
      document.body.insertAdjacentHTML("beforeEnd",iframeHTML);
    // document.body.innerHTML+=iframeHTML;
  //    IFrameObj.document.location.iframe = document.getElementById(id);
  IFrameObj=document.getElementById(id)
      return;
      
      var tempIFrame=document.createElement('iframe');
      tempIFrame.id=id;
       tempIFrame.name=name;
         
      tempIFrame.style.border='0px';
      tempIFrame.style.width='400px';
      tempIFrame.style.height='400px';
      IFrameObj = document.body.appendChild(tempIFrame);
      
      if (document.frames) {
       
        IFrameObj = document.frames[id];
      }
    } catch(exception) {
   
      iframeHTML='\<iframe id="'+id+'" name="'+name+'" style="';
      iframeHTML+='border:0px;';
      iframeHTML+='width:490px;';
      iframeHTML+='height:490px;display:inline;';
      iframeHTML+='"><\/iframe>';
      document.body.innerHTML+=iframeHTML;
      IFrameObj = new Object();
      IFrameObj.document = new Object();
      IFrameObj.document.location = new Object();
      IFrameObj.document.location.iframe = document.getElementById(id);
      IFrameObj.document.location.replace = function(location) {
        this.iframe.src = "";
      }
    }
  }
  
  
  return false;

}
function setChecked(formName,selectName,value,notEvent)
{
	
	if(!document[formName] || !document[formName][selectName])
	 return false;
	selectElem=document[formName][selectName];
	if (selectElem.type == 'checkbox' && selectElem.value==value)
	{
		
		selectElem.checked=true;
	}
	else if (selectElem.type == 'select-one')
	{
		for(i=0;i<selectElem.options.length;i++)
		{
			if(selectElem.options[i].value==value)
			{
				selectElem.selectedIndex=i;
				break;
			}
		}
	} else if (selectElem.type == 'text') {
		 
		selectElem.value=value;
	} else 	{
		
		for(i=0;i<selectElem.length;i++)
		{
			 
			if(selectElem[i].value==value)
			{ 
				 
				if(selectElem.type=='checkbox' || !selectElem.type)
				{
					 
				  selectElem[i].checked = true;
				}
				else 
					selectElem[i].selected = true;
				break;
			}
		}
	}
	if(!notEvent)
	{
		if(selectElem.onchange)
			selectElem.onchange()
		if(selectElem.onclick)
			selectElem.onclick()
	}
}

function arraySearch(arr, val) {
	for(var k in arr)
		if(arr[k] == val)
			return k;
	return false;
}

function shopWindowCounter(aid, pid, dontWrite) {
	var d = new Date()
	if(dontWrite) {
		var cntrTmpImgLoad = new Image();
		cntrTmpImgLoad.src = '/hit/window.gif?ilanid='+aid+'&pa_id='+pid+'&rd='+d.getTime();
	} else {
		document.write('<div style="display:none"><img src="/hit/window.gif?ilanid='+aid+'&pa_id='+pid+'&rd='+d.getTime()+'"></div>');
	}
}
function getBannerHtml(bannerFile,w,h,url,bgcolor,notBannerFlag)
{
	
	if(!notBannerFlag)
	{
		var d = new Date()
		bnKiller="<div style='position:absolute;height:0px;width:0px;display:none'><img src='/real_estate/images/b/b.gif?bf="+bannerFile+"&dt="+d.getTime()+"'></div>";
	}
	else
		bnKiller="";
	if(!bgcolor)
	{
		bgcolor = '#FFFFFF';
	}
	if(bannerFile.indexOf(".swf")!=-1){	
		
		if(!notBannerFlag)
		{
			
			swfURL=URLEncode("/real_estate/redirect.php?bid="+bannerFile+"&goURL="+url);	
			bannerFile='/real_estate/images/b/'+bannerFile+'?clickTag='+swfURL+'&clickTAG='+swfURL
			
		}
		 
		
		
		return	'<script type="text/javascript">'+
				'AC_FL_RunContent( \'codebase\',\'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\',\'width\',\''+w+'\',\'height\',\''+h+'\',\'src\',\''+bannerFile+'\',\'quality\',\'high\',\'pluginspage\',\'http://www.macromedia.com/go/getflashplayer\',\'movie\',\''+bannerFile+'\',\'wmode\',\'transparent\' );'+
				'</script>'+
				'<noscript>'+
					'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'">'+
  						'<param name="movie" value="'+bannerFile+'" />'+
  						'<param name="quality" value="high" />'+
  						'<param name="bgcolor" value="'+bgcolor+'" />' +
  						'<param name="wmode" value="transparent" />' +
  						'<embed bgcolor="'+bgcolor+'" wmode="transparent" src="'+bannerFile+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>'+
					'</object>'+
				'</noscript>'+bnKiller;
				//<script type="text/javascript" src="/real_estate/_js/fixit.js?b='+bannerFile+'"></script>
	}
	else if(bannerFile.indexOf(".php")!=-1){
		return '<script src="/real_estate/images/b/'+bannerFile+'"></script>'+bnKiller;
		
	}
	else{
		swfURL="/real_estate/redirect.php?bid="+bannerFile+"&goURL="+URLEncode(url);
		return '<a href="'+swfURL+'" target="_blank"><img src="/real_estate/images/b/'+bannerFile+'"></a>'+bnKiller;
	}

}
function getB(bnFile,w,h,url,bgcolor,notBnFlag,extraParam)
{
	
	if(!notBnFlag)
	{
		var d = new Date()
		bnKiller="<div style='position:absolute;height:0px;width:0px;display:none'><img src='/real_estate/images/b/b.gif?bf="+bnFile+"&dt="+d.getTime()+"'></div>";
	}
	else
		bnKiller="";
	if(!bgcolor)
	{
		bgcolor = '#FFFFFF';
	}
	if(bnFile.indexOf(".swf")!=-1){	
		
		if(!notBnFlag)
		{
			
			swfURL=URLEncode("/real_estate/redirect.php?bid="+bnFile+"&goURL="+url);	
			bnFile='/real_estate/images/b/'+bnFile+'?clickTag='+swfURL+'&clickTAG='+swfURL
			if(extraParam)
				bnFile+=extraParam
		}
		 
		
		
		return	'<script type="text/javascript">'+
				'AC_FL_RunContent( \'codebase\',\'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\',\'width\',\''+w+'\',\'height\',\''+h+'\',\'src\',\''+bnFile+'\',\'quality\',\'high\',\'pluginspage\',\'http://www.macromedia.com/go/getflashplayer\',\'movie\',\''+bnFile+'\',\'wmode\',\'transparent\' );'+
				'</script>'+
				'<noscript>'+
					'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'">'+
  						'<param name="movie" value="'+bnFile+'" />'+
  						'<param name="quality" value="high" />'+
  						'<param name="bgcolor" value="'+bgcolor+'" />' +
  						'<param name="wmode" value="transparent" />' +
  						'<embed bgcolor="'+bgcolor+'" wmode="transparent" src="'+bnFile+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>'+
					'</object>'+
				'</noscript>'+bnKiller;
				//<script type="text/javascript" src="/real_estate/_js/fixit.js?b='+bnFile+'"></script>
	}
	else if(bnFile.indexOf(".php")!=-1){
		return '<script src="/real_estate/images/b/'+bnFile+'"></script>'+bnKiller;
		
	}
	else{
		swfURL="/real_estate/redirect.php?bid="+bnFile+"&goURL="+URLEncode(url);
		return '<a href="'+swfURL+'" target="_blank"><img src="/real_estate/images/b/'+bnFile+'"></a>'+bnKiller;
	}

}
function lastViseted(cnt)
{
	 
	var str='';
	var last_cookie = new CJL_CookieUtil("lastVisitedData", 90000,"/");
	for(i=1;i<=cnt;i++){
		if(!last_cookie.getSubValue("ad_id_"+i))
			break;
		if(__PORTAL_ID==1)
		{
			id_name="ad_id"
			str+='<tr id="populer_lister_tr">'+
			'<td><img src="/real_estate/images/arrow_red.gif"/></td>'+
			'<td onMouseOver="showBigLastImg(\''+last_cookie.getSubValue("firstPic_"+i)+'\',this)" onMouseOut="hideLastImg(this)" >'+
			'<a style="text-decoration:none;" href="/real_estate/'+last_cookie.getSubValue("section_"+i)+'/advertise_detail.php?'+id_name+'='+last_cookie.getSubValue("ad_id_"+i)+'">'+
			'<span class="text_blue">'+last_cookie.getSubValue("city_"+i)+' '+last_cookie.getSubValue("location_"+i)+'</span><br>'+
			last_cookie.getSubValue("category_"+i)+'<br>'+last_cookie.getSubValue("visit_"+i)+' <br><span class="text_orange">'+last_cookie.getSubValue("price_"+i)+'</span><br></td></tr><tr><td colspan="2" height="1"><img src="/real_estate/images/spacer.gif" id="line_gri"/></td></tr>'	
		}
		else if(__PORTAL_ID==2)
		{
			tmp_image=last_cookie.getSubValue("firstPic_"+i);
			if(tmp_image=="")
			{
				tmp_image='noimageOto.gif';
			}
			id_name="ilan_id"
			str+='<div class="w64_48 fLeft marRight5px marBottom5px"><a href="/oto/'+last_cookie.getSubValue("section_"+i)+'/detay.php?ilan_id='+last_cookie.getSubValue("ad_id_"+i)+'"><img src="'+imgPaths[0]+'_th_1/'+tmp_image+'" class="fLeft marBottom5px" /></a></div>'+
			'<p><a href="/oto/'+last_cookie.getSubValue("section_"+i)+'/detay.php?'+id_name+'='+last_cookie.getSubValue("ad_id_"+i)+'"><strong>'+last_cookie.getSubValue("brand_"+i)+'</strong><br />'+
			last_cookie.getSubValue("serie_"+i)+'<br /><span class="text_blue">'+last_cookie.getSubValue("att2_"+i)+' / '+last_cookie.getSubValue("att1_"+i)+' Km</span><br />'+
			'<span class="text_orange"><strong>'+last_cookie.getSubValue("price_"+i)+'</strong></span></a></p>';
			if(i<cnt)
				str+='<div class="separator marTop5px marBottom10px"></div>';
		}
		
	}
	if(str=='')
	 	return
	 if(__PORTAL_ID==1)
		document.write('<div id="mtr_box"><div id="caption">SON GEZDİKLERİM</div><table>'+str+'<tr><td colspan="2" id="all_advertise"><img src="/real_estate/images/arrow_red.gif"/><a href="/real_estate/advertise_my_list.php?islastvisited=1&new_search=1" class="red_link">Tüm Son Gezdiklerim</a></td></tr></table></div>');
	else 
		document.write('<div id="mtr_box" class="mtrboxpadding"><h1>SON GEZDİKLERİM</h1>'+str+'<p class="aRight"><img src="/oto/_img/arrow_forward.gif" class="marRight3px"><a href="/oto/advertise_my_list.php?islastvisited=1&new_search=1" class="blue_link_u">Tüm Son Gezdiklerim</a></p></div>');
}
function getCookie(name){
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
 
 
function addToFavorites(){
 	if (window.external)
 	{
 		if(__PORTAL_ID==2)
 		{
 			window.external.AddFavorite("http://www.hurriyetoto.com","Hürriyet Oto");
 		}
 		else
 		{
 			window.external.AddFavorite("http://www.hurriyetemlak.com","Hürriyet Emlak");
 		}
 	}
	else
	{ 
		siteAlertObj("Kullanmış olduğunuz browser bu işlemi desteklememektedir.","","Hata",2);
	}
} 
function checkAdvertiseNo(keyCode,tg){
	if(keyCode==109){
		tg.value=tg.value.replace('-','');
		document.getElementById('adsearchid').focus() ;
	} else if(tg.value=='0'&&((keyCode)==96||(keyCode)==48)){
		tg.value=0;
		document.getElementById('adsearchid').focus() ;
	} else if(keyCode==13){
		_AJAX.sendLoad('/real_estate/_AJAX/AJAX_advertise.php','uid='+document.getElementById('uid').value+'&'+'ad_id='+document.getElementById('adsearchid').value,'') ;
		return false
	}
	return false
}
function removeAllLinks()
{
	var links=document.getElementsByTagName("a");
	 
	for(i=0;i<links.length;i++)
		links[i].href="#"
}
 // --></script>
/*
<td onMouseOver="showBigLastImg('200610/540078001141719984249211_0_.jpg',this)" onMouseOut="hideLastImg(this)" ><a style="text-decoration:none;" href="/real_estate/residence/advertise_detail.php?ad_id=1146"><span class="text_blue">İzmir<br>Foça-Eski Foça</span><br>

					Satılık Köşk<br>6oda + 4 salon <br><span class="text_orange">450.000 YTL</span><br>
					</a></td>
				</tr><tr>
					<td colspan="2" height="1"><img src="/real_estate/images/spacer.gif" id="line_gri"/></td>
				</tr>
*/
/**********************************************/
var firstPos="";
function scrollSticky(elem)
{

var ie=document.all && !window.opera
var dom=document.getElementById

iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body

objref=(dom)? document.getElementById(elem) : document.all[elem];
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset

var docwidth=(ie)? iebody.clientWidth : window.innerWidth
docheight=(ie)? iebody.clientHeight: window.innerHeight
objheight=objref.offsetHeight
 
pos=scroll_top+10;
 
if((iebody.scrollHeight-objref.scrollHeight)<pos)
 return
	objref.style.top=(scroll_top+10)+"px"
  
}

var newwindow="";

function showBnr()
{
  
 for(i=1;i<=b_array.length;i++)
 {
  if(document.getElementById("b_"+i))
  document.getElementById("b_"+i).innerHTML=b_array[i-1]
 }
} 

var b_array=new Array();
function URLEncode( url)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext =url;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

return encoded;
	 
};

function URLDecode(url )
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var encoded = url;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				chNow= encoded.substr(i,3);
				switch(chNow)
				{
					case "%FD":
						chNow="ı"
					break;
					case "%DD":
						chNow="İ"
					break;
					case "%F0":
						chNow="ğ"
					break;
					case "%D0":
						chNow="Ğ"
					break;
					case "%FE":
						chNow="ş"
					break;
					case "%DE":
						chNow="Ş"
					break;
					default:
						chNow=unescape(chNow)
					break;
				}
				
				 
				plaintext += chNow;
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
			
		   plaintext += ch;
		   i++;
		}
	} // while
   return  plaintext;
  
};

function showVideo(tg)
{
	 
	 
	if(!document.getElementById("videoArea"))
	{
		
		document.getElementById('thumbBig').innerHTML+='<div id="videoArea"  style="position:absolute;left:'+findPosX(document.getElementById('thumbBig'))+'px;top:'+findPosYpos(document.getElementById('thumbBig'))+'px;width:400px;height:330px;text-align:center;padding:3px;background-color:white">'+getVideoFrame(tg)+'</div>' 
	}
	else
	{
		
		document.getElementById('videoArea').innerHTML=getVideoFrame(tg)
		document.getElementById("videoArea").style.display="block";
	}
}
function getVideoFrame(tg)
{
	
	return '<iframe frameborder="0" width="100%" height="100%" scrolling="No" marginheight="0" marginwidth="0" src="/real_estate/video.php?path='+tg+'"   ></iframe>'
}

function initForm(formname) {
	init_f = initFields.split("|");
	init_v = initValues.split("|");
	for(countInitVars = 0; countInitVars < init_f.length ; countInitVars++)
		if(!window.document[formname][init_f[countInitVars]].value)
			setChecked(formname, init_f[countInitVars], init_v[countInitVars]);
}

function isset(varname)  {
  if(typeof( window[ varname ] ) != "undefined") return true;
  else return false;
}

function getvars(formname) {
	var url = window.location.href;
	// dillerde set edilir. ve urlnin browser ve kodlamaya gore farkli decode edilmesini saglar
	if(isset('multilanguagePages'))
		url = (browserObject.ie())?getUrlObject.decode(url):URLDecode(url);
	else
		url = URLDecode(url);
	querystr1 = url.split("?");
	if(isset('setCidTo'))	setChecked(formname, "cid", setCidTo);
	if(isset('initFields'))	initForm(formname);
	if(querystr1.length > 1 && querystr1[1].length > 0) {
		querystr2 = querystr1[1];
		querystr3 = querystr2.split("&");
		for(var countget = 0; countget < querystr3.length ; countget++) {
			var tempGetVars = querystr3[countget].split("=");
			if(window.document[formname][tempGetVars[0]])
				setChecked(formname, tempGetVars[0], tempGetVars[1],true);
		}
	}
}

function addItem(selectObj_id, textAtr, valueAtr)
{
	var optionObj  = window.document.createElement('option');
	var selectMenu = window.document.getElementById(selectObj_id);
	for (var i=0; i<selectMenu.length; i++)
	{
		if (selectMenu.options[i].value == valueAtr) 
			return false;
	}
	if (optionObj) {
		optionObj.text	= textAtr;
		optionObj.value = valueAtr;
	}
	if (selectMenu) {
		try {
			selectMenu.add(optionObj,null);
		} catch(ex) {
			selectMenu.add(optionObj);
		}
	}
}


var getUrlObject = {
	// UTF destekli url encode decode fonksiyonlari
	// public method for url encoding
	encode : function (string) {
		return escape(this._utf8_encode(string));
	},

	// public method for url decoding
	decode : function (string) {
		return this._utf8_decode(unescape(string));
	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}
		return string;
	}

}

var browserObject = {
	ie			: function () {		return (navigator.userAgent.indexOf('MSIE')!= -1)?1:0;		},
	ff			: function () {		return (navigator.userAgent.indexOf('Firefox')!= -1)?1:0;	},
	netscape	: function () {		return (navigator.userAgent.indexOf('Netscape')!= -1)?1:0;	},
	opera		: function () {		return (window.opera)?1:0;									},
	safari		: function () {		return (navigator.vendor.indexOf('Apple')!= -1)?1:0;		},
	konqueror	: function () {		return (navigator.vendor.indexOf('KDE')!= -1)?1:0;			}
}