var arrowDirection=1;
var downImage="Images/ArrowDown.gif";
var upImage="Images/ArrowUp.gif";
function clock() {

//if (!document.layers && !document.all) return;
var digital = new Date();
var hours = digital.getHours();
var minutes = digital.getMinutes();
var seconds = digital.getSeconds();
var amOrPm ="";// "AM";

//var day=digital.getDay();
//var month=digital.getMonth();
//var year=digital.getFullYear();

//if(day.length==1)
//    day="0"+ day;
//if(month.length==1)
//    month="0"+ month;    
//var date=day+"/"+month+"/" + year;

var date=digital.toLocaleDateString();

//if (hours > 11) amOrPm = "";//"PM";
//if (hours > 12) hours = hours - 12;
//if (hours == 0) hours = 12;
if (minutes <= 9) minutes = "0" + minutes;
if (seconds <= 9) seconds = "0" + seconds;
dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;
//alert(document.getElementById("pendule").innerHTML);
if(document.getElementById("divDateTime"))
{
    document.getElementById("divDateTime").innerHTML = date+"<br>" +dispTime+"<br>";
    
    setTimeout("clock()", 1000);
 }
}


function Open54Web()
{
    window.open("http://www.2556.web.tr","2556Web");//,"height=210,width=500,status=yes,toolbar=no,menubar=no,location=no");

}

function OpenLinkPages()
{
    window.open("Pages/LinksClient.aspx","LinkPage","top=0,left=0,height=400,width=500,status=yes,toolbar=no,menubar=no,location=no");
}

var searchWindow=null;
function OpenSearch()
{
    searchWindow=window.open("Pages/Search.aspx","SearchPage","top=0,left=0,height=250,width=1000,status=yes,toolbar=no,menubar=no,location=no");

}




function SetSearch(res)
{
    var pDocument=searchWindow.document;
    var word=pDocument.getElementById("txtWord").value;
    var rowOrder=pDocument.getElementById("txtRowOrder").value;
    var profession=pDocument.getElementById("drpProfession").options(pDocument.getElementById("drpProfession").selectedIndex).value;
    var education=pDocument.getElementById("drpEducation").options(pDocument.getElementById("drpEducation").selectedIndex).value;
    var age=pDocument.getElementById("drpAge").options(pDocument.getElementById("drpAge").selectedIndex).value;
    var date1=pDocument.getElementById("txtDate1").value;
    var date2=pDocument.getElementById("txtDate2").value;
    var sex1=pDocument.getElementById("rblSex_0").checked;
    var sex2=pDocument.getElementById("rblSex_1").checked;
    var sex3=pDocument.getElementById("rblSex_2").checked;
    var sex=0;
    if(sex1)
        sex=0;
    else if(sex2)
        sex=1;  
    else if(sex3)
        sex=2;          
    var total=res+";"+word+";"+rowOrder+";"+profession+";"+education+";"+age+";"+date1+";"+date2+";"+sex;
    document.getElementById("hfAction").value="searchFromWindows";
    document.getElementById("hfDetail").value=total;
    document.forms[0].submit();
}

function WordProcess(dotId,stateOfProcess)
{

    if(dotId)
    {  
        if(stateOfProcess!=null)
        {
            document.getElementById("hfAction").value="getWordsArticlesWButton";
            document.getElementById("hfDetail").value=dotId;
            document.forms[0].submit();
        }
        else
        {
            document.getElementById("hfAction").value="getWordsArticles";
            document.getElementById("hfDetail").value=dotId;
            document.forms[0].submit();        
        }
    }
}

function OpenUserArticles(uId)
{
    document.getElementById("hfAction").value="getUserArticle";
    document.getElementById("hfDetail").value=uId;
    document.forms[0].submit();
}



function FeelingProcess(feelingId)
{

    if(feelingId)
    {  
        document.getElementById("hfAction").value="getFeelingArticles";
        document.getElementById("hfDetail").value=feelingId;
        document.forms[0].submit();
    }
}

function OpenGuzergah()
{
    window.open("OurPages8.aspx","OurPages","top=0,left=0,height=350,width=800,status=yes,toolbar=no,menubar=no,location=no");

}

function PlaySound()
{
        document.getElementById("player").setAttribute("src",document.getElementById('txtHFileName').value) ;
        document.getElementById("player").setAttribute("autostart",true) ;
        document.getElementById("player").setAttribute("fileName",document.getElementById('txtHFileName').value) ;
        //document.getElementById("player").fileName=soundPath;
        document.getElementById("player").play();
}

function RedirectOurPages(pageId)
{
    window.open("Pages/OurPages"+pageId+".aspx","OurPages","top=0,left=0,height=750,width=800,status=yes,toolbar=no,menubar=no,location=no");
    if(pageId=="1")
    {
//        document.getElementById("player").setAttribute("src",document.getElementById('txtHFileName').value) ;
//        document.getElementById("player").setAttribute("autostart",true) ;
//        document.getElementById("player").setAttribute("fileName",document.getElementById('txtHFileName').value) ;
//        document.getElementById("player").fileName=soundPath;
//        document.getElementById("player").play();
    }
        
}

function OpenPage7()
{
    window.open("Pages/OurPages7.aspx","OurPages7","top=200,left=200,height=100,width=250,status=yes,toolbar=no,menubar=no,location=no,scrollbars=1");
}

function OpenVarilBasi()
{
    window.open("Pages/VarilBasi.aspx","VarilBasi","top=0,left=0,height=430,width=870,status=yes,toolbar=no,menubar=no,location=no,scrollbars=1");
}

function OpenDLogo()
{
    window.open("Pages/DLogo.aspx","DLogo","top=0,left=0,height=290,width=855,status=yes,toolbar=no,menubar=no,location=no,scrollbars=1");
}

function RedirectOurPagesSameDir(pageId)
{
    document.location.href='OurPages'+pageId+'.aspx';

}

function SetInitalArrow()
{
    var arrowValue=document.getElementById("hfArrowStatus").value;
    if(arrowValue=="2")
        return;
    else if(arrowValue=="1")
        arrowDirection=1;
    else if(arrowValue=="2")
        arrowDirection=2;
    SetArrow();        
}
var  isMusicStartAlready=false;


 
function SetArrow()
{
    if(arrowDirection ==1)
    {         
        document.getElementById("tblSearchSub").style.display="none";
        
        if(document.getElementById("btnExit"))
           document.getElementById("btnExit").style.display="none"; 
           
        document.getElementById("tblFeelings").style.display="none";
        document.getElementById("tblAges").style.display="none";
        document.getElementById("tblSearch").style.height="100px";
        if(document.getElementById("divDateTime"))    
            document.getElementById("divDateTime").style.display="none";
        
        if(document.getElementById("tblUser"))
            document.getElementById("tblUser").style.height="100px";
            
        if(document.getElementById("tblEntrance"))
            document.getElementById("tblEntrance").style.height="100px";
            
        
        if(document.getElementById("tblUserEntry"))
            document.getElementById("tblUserEntry").style.display="none";            
               
        document.getElementById("hfArrowStatus").value="1";
        document.getElementById("mrqOil").style.display="inline";

         //document.getElementById("tblSearch").style.display="none";

        
        
        arrowDirection=2;
        
    }
    else if(arrowDirection ==2)
    {            
        document.getElementById("tblSearchSub").style.display="inline";
        document.getElementById("tblFeelings").style.display="inline";
        
        document.getElementById("tblAges").style.display="inline";
        document.getElementById("tblSearch").style.height="195px";
        
        document.getElementById("divDateTime").style.display="inline";     
        document.getElementById("divDateTime").style.height="110px";   
        
        if(document.getElementById("btnExit"))
           document.getElementById("btnExit").style.display="inline"; 
                       
        if(document.getElementById("tblUser"))   
            document.getElementById("tblUser").style.height="195px";
            
        if(document.getElementById("tblUserEntry"))
        {
  
            document.getElementById("tblUserEntry").style.display="inline";                            
        }            
            
        if(document.getElementById("tblEntrance"))
            document.getElementById("tblEntrance").style.height="195px";                      

        document.getElementById("hfArrowStatus").value="2";      
        
        document.getElementById("mrqOil").style.display="none";
        
        //alert(document.getElementById("player").outerHTML);
//        if(!isMusicStartAlready)
//        {
//            document.getElementById("player").setAttribute("src",document.getElementById('txtHFileName').value) ;
//            document.getElementById("player").setAttribute("autostart",true) ;
//            document.getElementById("player").setAttribute("fileName",document.getElementById('txtHFileName').value) ;
//            isMusicStartAlready=true;
//        }
        

                
        arrowDirection=1;
        
    }
}



function OpenRecommend()
{
    window.open("Pages/RecommendPage.aspx",null,"top=0,left=0,height=210,width=530,status=yes,toolbar=no,menubar=no,location=no");
 }

function OpenComplaints(aId,isMain)
{
    if(isMain=="True")
        window.open("Pages/ArticleComplaintPage.aspx?aId="+aId,"Complaints","top=0,left=0,height=210,width=500,status=yes,toolbar=no,menubar=no,location=no");
    else
        window.open("ArticleComplaintPage.aspx?aId="+aId,"Complaints","top=0,left=0,height=210,width=500,status=yes,toolbar=no,menubar=no,location=no");
}

function OpenReadArticleAndComplaints(aId)
{
    window.open("Pages/ArticleReadAndComplaintPage.aspx?aId="+aId,"FirstlyReadComplaints","top=0,left=0,height=400,width=600,status=yes,toolbar=no,menubar=no,location=no");
}

function WriteArticle()
{
    if(document.getElementById("hfIsUserIn").value=="0")
    {
         document.location.href="Pages/MembershipPage.aspx";
         return;
    }
    //alert(window.screen.height);
    window.open("Pages/UserArticleInput.aspx","WriteArticle","top=0,left=0,height="+(window.screen.height-80)+",width="+(window.screen.width-10)+",status=yes,toolbar=no,menubar=no,location=no");

}

function OpenDover()
{
    window.open("SDover.aspx","WriteArticle","top=0,left=0,height=480,width=1000,status=yes,toolbar=no,menubar=no,location=no");

}


function WriteArticleSameDir()
{
    window.open("UserArticleInput.aspx","WriteArticle","top=0,left=0,height="+(window.screen.height-80)+",width="+(window.screen.width-10)+",status=yes,toolbar=no,menubar=no,location=no");
    //window.open("UserArticleInput.aspx","WriteArticle","top=0,left=0,height=740,width=790,status=yes,toolbar=no,menubar=no,location=no");

}

function OpenUserOwnPage()
{

    var win=window.open("Pages/UserOwnPage.aspx",null,"top=0,left=0,height=760,width=1010,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no,resizable=yes");
    win.focus();

}

function OpenEditArticle(aN)
{
    window.open("UserArticleInput.aspxaN="+aN,null,"top=0,left=0,height="+(window.screen.height-80)+",width="+(window.screen.width-10)+",status=yes,toolbar=no,menubar=no,location=no");
    
    //window.open("Pages/UserArticleInput.aspx?aN="+aN,null,"top=0,left=0,height=740,width=800,status=yes,toolbar=no,menubar=no,location=no");
}

function OpenEditArticleSameDir(aN)
{    
    window.open("UserArticleInput.aspx?aN="+aN,"EditArticle","top=0,left=0,height="+(window.screen.height-80)+",width="+(window.screen.width-10)+",status=yes,toolbar=no,menubar=no,location=no");
}


var openingWindowHeight=10;
var openingWindowWidth=10;
var openingWindowEndHeight=100;
var openingWindowEndWidth=100;
var openingWindow=null;

function OpenChat()
{
    openingWindowEndHeight=210;
    openingWindowEndWidth=500;
    OpenEffectWindow("Chat.aspx","ChatWindow",openingWindowEndHeight,openingWindowEndWidth);
    //window.open("Chat.aspx","ChatWindow","top=0,left=0,height=210,width=500,status=yes,toolbar=no,menubar=no,location=no");

}

function ShowPassword()
{
    openingWindowEndHeight=210;
    openingWindowEndWidth=500;
    OpenEffectWindow("MemberPassRequestForTrick.aspx","MemberPassRequestForTrick",openingWindowEndHeight,openingWindowEndWidth);
    
    //window.open("MemberPassRequestForTrick.aspx","MemberPassRequestForTrick","top=0,left=0,height=210,width=500,status=yes,toolbar=no,menubar=no,location=no");
}

function OpenEffectWindow(url,winName)
{
    
    openingWindow=window.open(url,winName,"top=0,left=0,height=10,width=10,status=yes,toolbar=no,menubar=no,location=no");
//    if (!document.layers&&!document.all)
//    {
//        //win2.location=mylocation
//        openingWindow.resizeTo(openingWindowEndWidth,openingWindowEndHeight);
//        return
//    }
    openingWindow.resizeTo(10,10);   
    OpenEffectWindowLoop();
}
function OpenEffectWindowLoop(){
    if (openingWindowHeight<=openingWindowEndHeight)
    {
        
        openingWindowHeight=openingWindowHeight+5;
        openingWindow.resizeTo(openingWindowWidth,openingWindowHeight);

   }
   if (openingWindowWidth<=openingWindowEndWidth)
    {        
        openingWindowWidth=openingWindowWidth+5;
        openingWindow.resizeTo(openingWindowWidth,openingWindowHeight);
    }
    if (openingWindowWidth>=openingWindowEndWidth-20)
    {
        openingWindowHeight=10;
        openingWindowWidth=10;
        return;
    }
    setTimeout("OpenEffectWindowLoop()",10);
}

function OpenGBG()
{
    window.open("../Pages/OurPages11.aspx","GBG","top=200,left=200,height=360,width=870,status=yes,toolbar=no,menubar=no,location=no,scrollbars=1");
}

function OpenMeseleGiris()
{
    window.open("Pages/MeseleGiris.aspx","GBG","top=200,left=200,height=150,width=600,status=yes,toolbar=no,menubar=no,location=no,scrollbars=1");
}