/* Apply hack to cure IE6's text-selection bug. (Thanks to http://blog.tom.me.uk/2003/07/23/boie6selecta.php)
 * The original hack contained apparently superfluous code that caused hourglass thrashing on slower machines.
 * This code seems to work better. */

if (window.createPopup && document.compatMode && document.compatMode=="CSS1Compat")
{
    document.onreadystatechange = onresize = function fixIE6AbsPos()
	{
	    if (!document.body) return;
	    onresize = null;
	    //document.body.style.height = 0;
	    document.body.style.height = document.documentElement.scrollHeight+'px'; 
	    setTimeout(function(){ onresize = fixIE6AbsPos; }, 100);
	}
}

/* Now we've fixed IE6, enable dictionary look-up in the Sonpeygamber.net Sözlük. */

NS = (navigator.appName == "Netscape");

if (NS) document.captureEvents(Event.DBLCLICK);

document.ondblclick = dict;

function dict() {
    if (NS) {
	/* Uses depracated but compatible method */
	t = document.getSelection();
	pass_to_dictionary(t);
    } else {
	t = document.selection.createRange();
	if(document.selection.type == 'Text' && t.text != '') {
	    document.selection.empty();
	    pass_to_dictionary(t.text); 
	}
    }
}

function pass_to_dictionary(text) {
    var dictWindow;
    if (text > '') {
	dictWindow=window.open('http://www.sonpeygamber.net/sozluk/123soz123pencere.asp?Action=Arama+Yap&z_kelime=LIKE%2C%27%25%2C%25%27&x_kelime=' +text , 
			       'dictwindow', 
			       'height=600, width=700, resizable=yes, scrollbars=yes');
	if (window.focus) { dictWindow.focus() }
    }
    
}

