﻿function dialogImage(txtName)
{
	var elm = document.getElementById( txtName )
	var html = showModalDialog("/Common/FCKEditorV2/editor/dialog/kh_image.html", elm, "dialogWidth:" + 400 + "px;dialogHeight:" + 420 + "px;help:no;scroll:no;status:no");
	// The response is the IMG tag HTML
	if (html != null)
		elm.value = html ;
}

function pencereac(adres,w,en,boy,Icerik)
{
window.open(adres,'','width='+en+', height='+boy+' ,scrollbars=yes,toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,copyhistory=no' );
//document.write(Icerik);
}

function ShowHelp(div, title, desc)
{
	div.style.display = 'inline';
	div.style.position = 'absolute';
	div.style.width = '200';
	div.style.backgroundColor = '#D7EBFF';
	div.style.border = 'dashed 1px black';
	div.style.padding = '10px';
	div.innerHTML = '<b>' + title + '</b><br><div style="padding-left:10; padding-top:5; padding-right:5">' + desc + '</div>';
}
	function HideHelp(div)
{
	div.style.display = 'none';
}

function ShowPreview(div, StartTag, title, EndTag)
{
	div.style.display = 'inline';
	div.style.position = 'absolute';
	div.style.backgroundColor = '#D7EBFF';
	div.style.border = 'solid 1px black';
	div.innerHTML = StartTag + title.toUpperCase() + EndTag;
}
	function HidePreview(div)
{
	div.style.display = 'none';
}

function ExpandMenu(item)
{
    window.setTimeout("ToggleMenu('" + item + "')",0);
    window.setTimeout("ToggleMenu('" + item + "_img1')",0);
    window.setTimeout("ToggleMenu('" + item + "_img2')",0);
    window.setTimeout("ToggleMenu('" + item + "_show')",0);
}
function GetItem(ItemId) {
    var item;
    if (document.all) {
        item = document.all[ItemId];		        
    }
    if (!document.all && document.getElementById) {
        item = document.getElementById(ItemId);		        
    }
    return item;
}
function GetMenuState(itemId) {
    var item = GetItem(itemId);	        
    return item.style.display;
}

function ToggleMenu(itemId) {
    var itemstate = GetMenuState(itemId);
    if (itemstate == "none") {		        
        itemstate = "inline";
    }
    else {
        itemstate = "none";		
    }
    GetItem(itemId).style.display=itemstate;
}

function changeSize(elm, _size, class_name)
{
	document.getElementById(elm).className = class_name + ' ' + class_name + '_' + _size;
	Set_Cookie('text_size', _size, 30, '/', 'kenthaber.com', '');
}

function changeSizex(elm, class_name)
{
	_size=Get_Cookie('text_size');
	document.getElementById(elm).className = class_name + ' ' + class_name + '_' + _size;
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	var today = new Date();
	today.setTime( today.getTime() );

	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" + escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
function Get_Cookie( name )
{
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
	{
		return null;
	}
	if ( start == -1 )
		return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 )
		end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
function Delete_Cookie( name, path, domain )
{
	if ( Get_Cookie( name ) )
		document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
function changeTarget(elm)
{
	tmp = elm.getElementsByTagName("a");
	for(i=0; i<tmp.length; i++)
		tmp[i].target = "_blank";
}

