﻿/**
 * default.aspx
 */


if (top != self)
{
    //alert("esc frame");
	top.location.href = self.location.href;
}

window.onload = function() {
    // do stuff here
    timeID = setTimeout("HideModalPopup1('pnlPopup1')", 1000);
    //HideModalPopup1('pnlPopup1');
    set_screen_size();
    roll_me();
}

function pageLoad(sender, args) {
            ShowModalPopup1('pnlPopup1');
            //var sm = Sys.WebForms.PageRequestManager.getInstance();
            //if (!sm.get_isInAsyncPostBack()) {
                //sm.add_beginRequest(onBeginRequest);
                //sm.add_endRequest(onRequestDone);
            //}
        }

function roll_me() {

            
            var myListBar = top.NavFrame.nav.iglbar_getListbarById('UltraWebListbar1');
            var found = false;
            var mygroupcount = 0;


            if (myListBar != null) {
                mygroupcount = myListBar.groupCount-1;
                for (var i = 0; i < myListBar.groupCount; i++) {

                    if ((myListBar.Groups[i].getText() == 'Αναζήτηση') | (myListBar.Groups[i].getText() == 'Search')) {
                        found = true;
                    }
                }

                if (found) {
                    myListBar.Groups[0].setSelected(true);
                }
                else {
                    //alert('mygroupcount = ' + mygroupcount);
                    myListBar.Groups[mygroupcount].setSelected(true);
                } 

            }
}        
        
function onBeginRequest(sender, args) {
            //var send = args.get_postBackElement()
            var myLoginMessageClientID = document.getElementById("LoginMessageClientID").value;
            
            if (myLoginMessageClientID != null)
            {
            var myLoginMessageObject = document.getElementById(myLoginMessageClientID);
              //myLoginMessageObject.innerText = "";
              var myLoginStatus = document.getElementById("LoginStatus").value;
              myLoginMessageObject.innerHTML = myLoginStatus;
            }
            
        }
        
function onRequestDone() {
          var myloginstatus = document.getElementById("LoginStatusClientID").value;
          var NewStatus = document.getElementById(myloginstatus);
          
          if (NewStatus.value != "none")
            {
              alert(NewStatus.value);
            }
        }




function set_screen_size()
{

var winW = 0, winH = 0;
var my_header_div = 0, my_footer_div = 0;

var window_height_min_value = 481;


if (self.innerWidth) {
      winW = self.innerWidth;
      winH = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientWidth) {
      winW = document.documentElement.clientWidth;
      winH = document.documentElement.clientHeight;
}
else if (document.body) {
      winW = document.body.clientWidth;
      winH = document.body.clientHeight;
}


my_header_div = parseInt(document.getElementById('header_div').style.height,0);
my_footer_div = parseInt(document.getElementById('footer_div').style.height,0);
 
 
var new_height = winH - my_header_div - my_footer_div -6;
var new_width = winW;

//alert("winH: " + winH);
//alert("new_height: " + new_height);

if (new_width >= 756) {
    //document.getElementById('NavFrame').width = new_width + "px";
    //top.main.location.reload(); 
}
else {
   // document.getElementById('NavFrame').width = "756px";
    //top.bottom.document.getElementById('WebGroupBox_Footer').style.width = "756px";
    //top.main.location.reload(); 
}

if (winW >= 934) {

   // top.top1.document.getElementById('WebGroupBox_Company_Name').style.width = winW + "px";
   // top.top1.document.getElementById('UltraWebToolbar1').style.width = winW + "px";
   // top.bottom.document.getElementById('WebGroupBox_Footer').style.width = winW + "px";
    
    
}
else {

  //  top.top1.document.getElementById('WebGroupBox_Company_Name').style.width = "934px";
  //  top.top1.document.getElementById('UltraWebToolbar1').style.width = "934px";
  //  top.bottom.document.getElementById('WebGroupBox_Footer').style.width = "934px";
    
}



if (new_height >= window_height_min_value) {
    // alert('new_height=' + new_height);
   // document.getElementById('navigation_div').style.height = new_height + "px";
    //document.getElementById('nav').height = new_height;
    //document.getElementById('main').height = new_height;
    //document.getElementById("hideme").value = new_height;
    //alert("navigation frame Resize");
    //alert("index.html");
}


document.getElementById('navigation_div').style.height = new_height + "px";

}

if (window.addEventListener) //DOM method for binding an event
     window.addEventListener("resize", set_screen_size, false)
else if (window.attachEvent) //IE exclusive method for binding an event
    window.attachEvent("onresize", set_screen_size)


function ShowModalPopup(ctrl)
{
    var modalPopupBehavior = $find(ctrl);
    modalPopupBehavior.show();
}


function HideModalPopup1(ctrl) {
    var modalPopupBehavior1 = $find(ctrl);
    if (modalPopupBehavior1 != null) {
        modalPopupBehavior1.hide();
    }
}


function ShowModalPopup1(ctrl) {
    var modalPopupBehavior1 = $find(ctrl);
    if (modalPopupBehavior1 != null) {
        modalPopupBehavior1.show();
    }
}






 var mystyle = "none";
 var myculture = "none";
 
 function getFunction()
{
        // Obtain Styles WebCombo object
        var StyleComboID = document.getElementById("StylesWebComboClientID").value;
        var StylesCombo = igcmbo_getComboById(StyleComboID);
        

      if (StylesCombo.getDataValue() != null)
       {
        //window.location ="Test.aspx?displayed=" + combo.getDisplayValue() + "&id="+combo.getDataValue();
        //alert("getDisplayValue() = " + combo.getDisplayValue());
        //alert("getDataValue() = " + combo.getDataValue());
        mystyle = StylesCombo.getDataValue();
      }
      
      // Obtain Cultures WebCombo object
        var CulturesComboID = document.getElementById("CulturesWebComboClientID").value;
        var CulturesCombo = igcmbo_getComboById(CulturesComboID);
        

      if (CulturesCombo.getDataValue() != null)
       {
        //window.location ="Test.aspx?displayed=" + combo.getDisplayValue() + "&id="+combo.getDataValue();
        //alert("getDisplayValue() = " + combo.getDisplayValue());
        //alert("getDataValue() = " + combo.getDataValue());
        myculture = CulturesCombo.getDataValue();
      }

      
      if ((StylesCombo.getDataValue() != null) & (CulturesCombo.getDataValue() != null))
      {
        var myCurrentCulture = document.getElementById("CulturesSessionStore").value;
        
        if (myCurrentCulture == myculture)
          {
            var myControlTypeHidden = document.getElementById("myControlType").value;
            var myControlTypeParamsHidden = document.getElementById("myControlTypeParams").value;
          }
          else {
              var myControlTypeHidden = document.getElementById("myControlType").value;
              var myControlTypeParamsHidden = document.getElementById("myControlTypeParams").value;
          
            //var myControlTypeHidden = "";
            //var myControlTypeParamsHidden = "";
          }
                  
         parent.location.href = "default.aspx?mystyle=" + mystyle + "&myculture=" + myculture + "&myControlType=" + myControlTypeHidden + "&myControlTypeParams=" + myControlTypeParamsHidden;
      }        

 
  return true;
}
function RestoreBoxFunction() {
    setStyle();
    setCulture();
    return true;
}


 function setStyle()
{
        // Obtain WebCombo object
        var StyleComboID = document.getElementById("StylesWebComboClientID").value;
        var StylesCombo = igcmbo_getComboById(StyleComboID);

        //window.location ="Test.aspx?displayed=" + combo.getDisplayValue() + "&id="+combo.getDataValue();
        var StyleSessionValue = document.getElementById("StylesSessionStore").value;
        //StylesCombo.setDisplayValue(StyleSessionValue);
        StylesCombo.setDataValue(StyleSessionValue);

 
  return true;
} 


 function setCulture()
{
        // Obtain WebCombo object
        
        var CulturesComboID = document.getElementById("CulturesWebComboClientID").value;
        var CulturesCombo = igcmbo_getComboById(CulturesComboID);

        //window.location ="Test.aspx?displayed=" + combo.getDisplayValue() + "&id="+combo.getDataValue();
        var CultureSessionValue = document.getElementById("CulturesSessionStore").value;
        //CulturesCombo.setDisplayValue(CultureSessionValue);
        CulturesCombo.setDataValue(CultureSessionValue);

 
  return true;
} 



