﻿function ChecktheSearh()
{

if  (document.getElementById("WordSearch").value=='Αναζήτηση')
{
document.getElementById("WordSearch").value=''
}

if  (document.getElementById("WordSearch").value=='Search')
{
document.getElementById("WordSearch").value=''
}

if  (document.getElementById("WordSearch").value=='Suchen')
{
document.getElementById("WordSearch").value=''
}
}

function ChangeColor(obj,objColor)
{

document.getElementById(obj).style.color=objColor ;
}
function ChangeBgButColor(obj,objColor)
{

document.getElementById(obj).style.backgroundColor=objColor ;
}
function Js_Open_SelectedTrs_LeftMenu(SelectedTrs)
{
   var col_array=SelectedTrs.split(",");
        var part_num=0;

        while (part_num < col_array.length)
             {
              if  (col_array[part_num]||'')
              {
             
              IdTRs=document.getElementById('LeftMenuMain__'+col_array[part_num]);
             
              div = IdTRs;
         
              div.style.display = "";
               }      
        part_num+=1;
              }
}
function ShowHiddenLabel(obj)
{
if (document.getElementById(obj).style.display=='none')
   {
    document.getElementById(obj).style.display='inline';
   }
else
   {
    document.getElementById(obj).style.display='none';
   }
}

function Js_MouseOverBack_All_Trs(AllTrs,LevelType)
{

 var col_array2=AllTrs.split(",");
        var part_num2=0;

        while (part_num2 < col_array2.length)
             {
if (col_array2[part_num2]=='')
{
}
else
{
              IdTRs2=document.getElementById('LeftMenuMain__'+col_array2[part_num2]+'_');
              IdTRs1=document.getElementById('LeftMenuMain__'+col_array2[part_num2]);
            
              div2 = IdTRs2;
              div1 = IdTRs1;
              if (LevelType==1)
              {
              
              
                
               
              div1.style.color='black';
              div2.style.backgroundColor='rgb(232, 232, 232)';
              div1.style.backgroundColor='rgb(232, 232, 232)';
              
              div2.onmouseover = new Function("this.style.backgroundColor='rgb(232, 0, 1)';document.getElementById('LeftMenuMain__"+col_array2[part_num2]+"').style.backgroundColor='rgb(232, 0, 1)';document.getElementById('LeftMenuMain__"+col_array2[part_num2]+"').style.color='white';")
              div2.onmouseout = new Function("this.style.backgroundColor='rgb(232, 232, 232)';document.getElementById('LeftMenuMain__"+col_array2[part_num2]+"').style.backgroundColor='rgb(232, 232, 232)';document.getElementById('LeftMenuMain__"+col_array2[part_num2]+"').style.color='black';")
              
              
              }
              else
              {
              
              div1.style.color='black';
              div2.onmouseover = new Function("document.getElementById('LeftMenuMain__"+col_array2[part_num2]+"').style.color='red';")
              div2.onmouseout = new Function("document.getElementById('LeftMenuMain__"+col_array2[part_num2]+"').style.color='black';")
              }
             
 }                 

      
        part_num2+=1;
            }
}



function Js_Close_All_Trs(AllTrs)
{

 var col_array2=AllTrs.split(",");
        var part_num2=0;

        while (part_num2 < col_array2.length)
             {
if (col_array2[part_num2]=='')
{
}
else
{


              IdTRs2=document.getElementById('LeftMenuMain__'+col_array2[part_num2]);
             
              div2 = IdTRs2;
              div2.style.display = "none";
 }                 

      
        part_num2+=1;
            }
}

function FindUrl(MenuCategId,ProdCateID,ProdID,LevelNo)
{
var DataToSendOne = "MenuCategId=" + MenuCategId ;
	var DataToSendTow = "&ProdCateID=" + ProdCateID ;
	var DataToSendThi = "&LevelNo=" + LevelNo ;
	
	var DataToSendFor = "&returnTitleUrl=yes" ;
	var DataToSendFive = "&ProdID=" + ProdID ;
	
	
	
	var xmlhttp  ;

if(window.ActiveXObject)
{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
            xmlhttp = new XMLHttpRequest();
}
	
	xmlhttp.open("POST","http://localhost:1221/alco/usercontrols/FindUrl.aspx",false);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send(DataToSendOne + DataToSendTow + DataToSendThi + DataToSendFor  + DataToSendFive);
	
	document.getElementById('urls').value=xmlhttp.responseText;
	
	var DataToSendForSec = "&returnTitleUrl=no" ;
	
	var xmlhttpSec ;
	
	if(window.ActiveXObject)
{
            xmlhttpSec = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
            xmlhttpSec = new XMLHttpRequest();
}
	
	xmlhttpSec.open("POST","http://localhost:1221/alco/usercontrols/FindUrl.aspx",false);
	xmlhttpSec.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttpSec.send(DataToSendOne + DataToSendTow + DataToSendThi + DataToSendForSec + DataToSendFive);
	alert(xmlhttpSec.responseText);
	document.getElementById('SelectedUrl').value=xmlhttpSec.responseText;
}


function ColorTheSelectedURL()
{
if (document.getElementById('SelectedUrl').value!='')
   {
   
   var xmlhttp1 ;
   
   if(window.ActiveXObject)
{
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
            xmlhttp1 = new XMLHttpRequest();
}
   
	xmlhttp1.open("POST","http://localhost:1221/alco/usercontrols/MouseOverBack.aspx",false);
	xmlhttp1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp1.send("");
	Js_MouseOverBack_All_Trs(xmlhttp1.responseText,2);
	
	
	
   var xmlhttp1_ ;
   
    if(window.ActiveXObject)
{
            xmlhttp1_ = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
            xmlhttp1_ = new XMLHttpRequest();
}
   
	xmlhttp1_.open("POST","http://localhost:1221/alco/usercontrols/MouseOverBack.aspx?MenuCategId=1",false);
	xmlhttp1_.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp1_.send("");
	
	Js_MouseOverBack_All_Trs(xmlhttp1_.responseText,1);
	
   
   
   var AllTrs = document.getElementById('SelectedUrl').value;
    var col_array2=AllTrs.split(",");
        var part_num2=0;

        while (part_num2 < col_array2.length)
             {
              if (col_array2[part_num2]=='')
                 {
                 }
              else
                 {
                 
                 if (part_num2==0)
                    {
                    IdTRs2=document.getElementById('LeftMenuMain__'+col_array2[part_num2]);
                    IdTRs3=document.getElementById('LeftMenuMain__'+col_array2[part_num2]+'_');
             
                    div2 = IdTRs2;
                    div3 =IdTRs3;
                    
                    
                    div2.style.color = "white";
                    div2.style.backgroundColor='rgb(232, 0, 1)';
                    div3.style.backgroundColor='rgb(232, 0, 1)';
                   div3.onmouseover = new Function("return null");
                    div3.onmouseout = new Function("return null");
                    }
                 else
                    {
                    
                    IdTRs2=document.getElementById('LeftMenuMain__'+col_array2[part_num2]);
                    IdTRs3=document.getElementById('LeftMenuMain__'+col_array2[part_num2]+'_');
                    
                    div2 = IdTRs2;
                    div3 =IdTRs3;
                    
                    div2.style.color = "red";
                    div3.onmouseover = new Function("return null");
                    div3.onmouseout = new Function("return null");
                    }
                  
                  }                 

      
              part_num2+=1;
             }
   }

}


function tesfunct(values,Descr) {
//alert(values + '---' + Descr);
	var xmlhttp1 ;
	
	if(window.ActiveXObject)
{
            xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
            xmlhttp1 = new XMLHttpRequest();
}
	
	xmlhttp1.open("POST","http://localhost:1221/alco/usercontrols/CloseAlIDS.aspx",false);
	xmlhttp1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp1.send("");
	Js_Close_All_Trs(xmlhttp1.responseText);
	
	
	
	var DataToSend = "id=" + values ;
	var DataToSend1 = "&ids=" + Descr ;
	var xmlhttp ;
	
	if(window.ActiveXObject)
{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
            xmlhttp = new XMLHttpRequest();
}
	
	xmlhttp.open("POST","http://localhost:1221/alco/usercontrols/FindIDS.aspx",false);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send(DataToSend + DataToSend1);
	
	Js_Open_SelectedTrs_LeftMenu(xmlhttp.responseText);
	//alert(xmlhttp.responseText);
	
	
	
}

function ClearForNews()
{
if (document.getElementById('HDTextBoxForNews'))
                 {
                    document.getElementById('HDTextBoxForNews').value='';
                 }   
}



//////////////////////////////////////////////------------------------------------------


function ExpandLev(lev0,parentID,id, caller)
{
    if (lev0 == 0)
    {
        var trColl = document.getElementById('LeftMenuMainTable').childNodes[0].childNodes;
        for(i = 0; i <trColl.length; i++)
        {                                   
            if (trColl[i].id.indexOf('mnu_0_') > -1)
            {
                
                trColl[i].cells[0].className = 'CellCl1';
                trColl[i].cells[0].removeAttribute('selected');
                trColl[i].cells[0].onmouseover = new Function("tdPaint(this, 'CellCl1on')");
                trColl[i].cells[0].onmouseout = new Function("tdPaint(this, 'CellCl1')");
            }
        
            if (trColl[i].id.indexOf('mnu_1') == 0)
            {               
                trColl[i].style.display = 'none';
                trColl[i].cells[0].className = 'CellCl2';
                trColl[i].cells[0].removeAttribute('selected');
                trColl[i].cells[0].onmouseover = new Function("tdPaint(this, 'CellCl2on');");
                trColl[i].cells[0].onmouseout = new Function("tdPaint(this, 'CellCl2');")
            }
            else if(trColl[i].id.indexOf('mnu_2') == 0)
            {
                trColl[i].style.display = 'none';
                trColl[i].cells[0].removeAttribute('selected');
                trColl[i].cells[0].className = 'CellCl3';
                trColl[i].cells[0].onmouseover = new Function("tdPaint(this, 'CellCl3on');");
                trColl[i].cells[0].onmouseout = new Function("tdPaint(this, 'CellCl3');")
            }
        }
                
        
        
        for(i = 0; i < trColl.length; i++)
        {           
            if (trColl[i].id.indexOf('mnu_1_' + id) == 0)
            {
                trColl[i].style.display = '';              
            }
        }
        
        var obj = document.getElementById(caller).cells[0]
        obj.className = 'CellCl1on';
        obj.setAttribute('selected', 'yes');
    }
    
    if (lev0 == 1)
    {        
        var trColl = document.getElementById('LeftMenuMainTable').childNodes[0].childNodes;
        
        for(i = 0; i < trColl.length; i++)
        {
            
            if (trColl[i].id.indexOf('mnu_1') > -1)
            {               
            
                trColl[i].cells[0].className = 'CellCl2';
                trColl[i].cells[0].removeAttribute('selected');
                trColl[i].cells[0].onmouseover = new Function("tdPaint(this, 'CellCl2on');");
                trColl[i].cells[0].onmouseout = new Function("tdPaint(this, 'CellCl2');")
            }
            
        
            if (trColl[i].id.indexOf('mnu_2') == 0)
            {
                trColl[i].style.display = 'none';
            }
        }
        
        for (i=0;i<trColl.length;i++)
        {
            if (trColl[i].id.indexOf('mnu_2_' + parentID + '_' + id) == 0)
            {
                trColl[i].style.display = '';
            }
        }
        var obj = document.getElementById(caller).cells[0]
        obj.className = 'CellCl2on';
        obj.setAttribute('selected', 'yes');
    }
    
    if(lev0 == 2)
    {
        var obj = document.getElementById(caller).cells[0]
        obj.className = 'CellCl3on';
        obj.setAttribute('selected', 'yes');
    }
}

function ChangeTheColors(MenuId,MenuId2,MenuId3)
{
alert(MenuId);
alert(MenuId2);
alert(MenuId3);


}

function tdPaint(src, cl)
{  
    if(src.getAttribute('selected') != 'yes')
        src.className = cl;
}


function SpitMenu(){
    document.write('<table id="LeftMenuMainTable" width="100%" cellpadding="0" cellspacing="0" border="0">');
    var EndTag = '</table>';
    var menuTag = '';
    var ScriptActions='';
    var cntLev0=-1;var cntLev1=-1;var cntLev2=-1;
    for (i=0;i<mnuArr.length;i++){
    
        if (mnuArr[i][1] == 0)
        {
	        cntLev0++;
            var daClass='CellCl1';
            var daClasson='CellCl1on';
            var cellId = 'mnu_0_' + cntLev0;
            // - selected 
            if (mnuArr[i][3]==true) {
                daClass='CellCl1';
                daClasson='CellCl1on';
            }
            // - selected 
            document.write('<tr id="' + cellId + '">' +
		        '<td class="' + daClass + '" onClick="this.className=\'' + daClasson + '\';this.onmouseout=new Function(\'return false;\');" onmouseover="tdPaint(this, \'' + daClasson + '\');" onmouseout="tdPaint(this, \'' + daClass + '\');">' +
		        '<table border="0" cellspacing="0" cellpadding="0">' +
			    '    <tr>' +
				'        <td style="padding-left:1px;padding-right:5px"><img src="../images/leftmenu/PointerLevelOne.gif"  /></td>' +
				'        <td>');

			if (mnuArr[i][2].length==0)
				document.write('<a href="javascript: void(0);" onclick="javascript:ExpandLev(0,0,' + cntLev0 + ', \'' + cellId + '\');">');
		    else
		        document.write('<a href="' + mnuArr[i][2] + '">');
            // - expan 
            if (mnuArr[i][3]==true) ScriptActions+='ExpandLev(0,0,' + cntLev0 + ', \'' + cellId + '\');';
                       		        
			document.write(mnuArr[i][0] + '</a></td>' +
			    '    </tr>' +
		        '</table>' +
		        '</td>' +
	            '</tr>');
	   }
	   else{
            if (mnuArr[i][1] == 1)
            {
	            cntLev1++;
                var daClass='CellCl2';
                var daClasson='CellCl2on';
                //Selected
                if (mnuArr[i][3] == true) 
                {
                    daClass='CellCl2on';
                    daClasson='CellCl2on';
                }            
                //selected
                var cellId = 'mnu_1_' + cntLev0 + '_' + cntLev1;
                document.write('<tr id="' + cellId + '" style="display:none">' +
		            '<td class="' + daClass + '" onmouseover="tdPaint(this, \'' + daClasson + '\');" onmouseout="tdPaint(this, \'' + daClass + '\');">' +
		            '<table border="0" cellspacing="0" cellpadding="0">' +
			        '    <tr>' +
				    '        <td style="padding-left:10px"><img src="../images/leftmenu/PointerLevelSec.gif"  /></td>' +
				    '        <td>');
				    
			    if (mnuArr[i][2].length==0)
				    //menuTag+='<a href="javascript:ExpandLev(1,' + cntLev0 + ',' + cntLev1 + ');">'
				    document.write('<a href="javascript: void(0);" onclick="ExpandLev(1,' + cntLev0 + ',' + cntLev1 + ', \'' + cellId + '\');">');
		        else
		            document.write('<a href="' + mnuArr[i][2] + '">');
                 //Expant
                if (mnuArr[i][3]==true) ScriptActions+='ExpandLev(1,' + cntLev0 + ',' + cntLev1 + ', \'' + cellId + '\')';		        				
                
				document.write(mnuArr[i][0] + '</a></td>' +
			        '    </tr>' +
		            '</table>' +
		            '</td>' +
	                '</tr>');
	       }
	       else{	       	       	       
                if (mnuArr[i][1] == 2)
                {
                
                    var c3 = 'CellCl3';
                    var c3on = 'CellCl3on'
                    var sel = 'CellCl3';
                    var cellId = '';
                    
                    if(mnuArr[i][3] == true)
                    {
                         c3 = 'CellCl3on';
                         c3on = 'CellCl3on';
                         sel = c3on;
                    }
                
	                cntLev2++;
	                cellId = 'mnu_2_' + cntLev0 + '_' + cntLev1 + '_' + cntLev2;
                    document.write('<tr id="' + cellId + '" style="display:none">' +
		                '<td class="' + sel + '"  onmouseover="tdPaint(this, \'' + c3on + '\');" onmouseout="tdPaint(this, \'' + c3 + '\');">' +
		                '<table border="0" cellspacing="0" cellpadding="0">' +
			            '    <tr>' +
				        '        <td style="padding-left:18px"><img src="../images/leftmenu/PointerLevelThi.gif"  /></td>' +
				        '        <td><a href="' + mnuArr[i][2] + '">' + mnuArr[i][0] + '</a></td>' +
			            '    </tr>' +
		                '</table>' +
		                '</td>' +
	                    '</tr>');
	           }
	           
	           if (mnuArr[i][3]==true) ScriptActions+=';ExpandLev(2, 0, 0, \'' + cellId + '\')';
	           
	       }
	   }
    }
    document.write(EndTag);
    //document.getElementById('LeftMenuMain__menu').innerHTML = StartTag + menuTag + EndTag;
    eval(ScriptActions);
}

