//////// tereyağlı ballı ekmek javası
function hover ( elm ){
	elm.style.background="#6d84b4";
	elm.style.cursor="pointer";
}

function unhover(elm){
	elm.style.background="#567EB9";
	elm.style.cursor="default";
}
function hover2 ( elm ){
	elm.style.background="#6d84b4";
	elm.style.cursor="pointer";
}

function unhover2(elm){
	elm.style.background="#7696C7";
	elm.style.cursor="default";
}
///////////////////////  buda nerden cıktı javası
function LoadImage(targetDiv,imageSrc,imageAlt)
{
    var text = arguments[3]?arguments[3]:"Yükleniyor";
    var template = "<div align=center id=\"{0}_loading\"><img src=/i/loading.gif><br/>" + text +"</div><img id=\"{0}_img\" src=\"{1}\" alt=\"{2}\" style=\"display:none\" onload=\"ShowMeAfterLoad('{0}');\">";
    G(targetDiv).innerHTML =  template.Format(targetDiv,imageSrc,imageAlt);
}

function ShowMeAfterLoad(targetDiv)
{
    G(targetDiv + "_loading").style.display = 'none';
    G(targetDiv + "_img").style.display = 'block';
}
function fs(arrNameValue, target, frame)
{
    var html = new String("");
    for(var index = 0; index < arrNameValue.length; index += 2)
    {
        html += "<INPUT TYPE=\"HIDDEN\" NAME=\"" + arrNameValue[index] + "\" VALUE=\"" + arrNameValue[index+1] + "\">";
    }

    var newForm = document.createElement("FORM");
    newForm.action = target;
    newForm.target = frame;
    newForm.method = "POST";
    newForm.innerHTML = html;
    
    document.body.appendChild(newForm);
    newForm.submit();
}

function LoadCombo(id, onChange, firstItem)
{
    var cmbUI = UI.ObjectWithID(id);
    var opt = new Options("opt");

    var hierarchyList = arguments[3] && arguments[3]!=null?arguments[3].ItemList:null;
    var cmb = null;
    var selectedOption = arguments[5]?arguments[5]:"0";
    if (firstItem!="") opt.Add("0",firstItem);
    
    if (hierarchyList!=null)
    {
        for(var index=0;index<hierarchyList.length;index++)
        {
            if (hierarchyList[index]!=null)
            {
                if (hierarchyList[index].Id == selectedOption) 
                    opt.Add(hierarchyList[index].Id,hierarchyList[index].Description,true);
                else
                    opt.Add(hierarchyList[index].Id,hierarchyList[index].Description);
            }
        }
    }
    else if (arguments[4])
    {
        var options = arguments[4];
        for(var index=0;index<options.OptionList.length;index++)
        {
            if (options.OptionList[index].Key == selectedOption) 
                    opt.Add(options.OptionList[index].Key,options.OptionList[index].Value,true);
                else
                    opt.Add(options.OptionList[index].Key,options.OptionList[index].Value);
            
        }
    }
    
    if (cmbUI == null)
    {
        UI.Add(Constants.ObjectType.SelectInput,id,{list:opt,OnChange:onChange});
        cmb = G(id);
    }
    else
    {
        cmb = G(id);
        cmb.options.length = 0;
        for(var index=0;index<opt.OptionList.length;index++)
        {
            cmb.options[index] = new Option(opt.OptionList[index].Value,opt.OptionList[index].Key);
        }
    }
    if (onChange!="") {cmb.onchange = eval(onChange);}
}
