﻿///
///post data to server using post method
///
function showNeedMonth(data){

var xmlHttp;

if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
    
    var xmlHttp = new XMLHttpRequest();

}

else if(window.ActiveXObject){ // For Internet Explorer
    
    var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

}

xmlHttp.open('POST', 'calender.php', true);

xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

xmlHttp.onreadystatechange = function(){
    
    if (xmlHttp.readyState == 4){
       
       document.getElementById("div_calender").innerHTML = xmlHttp.responseText;
       
    } 
}

xmlHttp.send(data);
}
function MaxWindow(id)
{
    
    map.getInfoWindow().maximize();
    //setTimeout(showTd,100);
    if(id == 2 )
    {
       setTimeout(showTd2,100); 
    }else if(id == 3 )
    {
       setTimeout(showTd3,100); 
    }
    else if(id == 4 )
    {
       setTimeout(showTd4,100); 
    }
    else if(id == 5 )
    {
       setTimeout(showTd5,100); 
    }
}

function showTd2()
{
    var obj = document.getElementById( 'td2');
    if(obj)
    {
        for(var i=1;i<=5;i++)
        {
            if(obj.id == ("td"+i))
            {
               obj.className = 'bodercolor';
               document.getElementById('tr' + i).style.display ='block';;
            }
            else
            {
             if(document.getElementById('td' + i)){  
               document.getElementById('tr' + i).style.display ='none';
               document.getElementById('td' + i).className ='bodercolor1';
             }
            }
         }
    }
    else
    {
        setTimeout(showTd2,10);
    }
    
}
function showTd3()
{
    var obj = document.getElementById( 'td3');
    if(obj)
    {
        for(var i=1;i<=5;i++)
        {
            if(obj.id == ("td"+i))
            {
               obj.className = 'bodercolor';
               document.getElementById('tr' + i).style.display ='block';;
            }
            else
            {
             if(document.getElementById('td' + i)){  
               document.getElementById('tr' + i).style.display ='none';
               document.getElementById('td' + i).className ='bodercolor1';
             }
            }
         }
    }
    else
    {
        setTimeout(showTd3,10);
    }
    
}
 function showTd4()
{
    var obj = document.getElementById( 'td4');
    if(obj)
    {
        for(var i=1;i<=5;i++)
        {
            if(obj.id == ("td"+i))
            {
               obj.className = 'bodercolor';
               document.getElementById('tr' + i).style.display ='block';;
            }
            else
            {
             if(document.getElementById('td' + i)){  
               document.getElementById('tr' + i).style.display ='none';
               document.getElementById('td' + i).className ='bodercolor1';
             }
            }
         }     
    }
    else
    {
        setTimeout(showTd4,10);
    }
    
}
function showTd5()
{
    var obj = document.getElementById( 'td5');
    if(obj)
    {
        for(var i=1;i<=5;i++)
        {
            if(obj.id == ("td"+i))
            {
               obj.className = 'bodercolor';
               document.getElementById('tr' + i).style.display ='block';;
            }
            else
            {
             if(document.getElementById('td' + i)){  
               document.getElementById('tr' + i).style.display ='none';
               document.getElementById('td' + i).className ='bodercolor1';
             }
            }
         }
    }
    else
    {
        setTimeout(showTd5,10);
    }
    
}
function  showMessage(id)
{
    var obj = document.getElementById(id);
    if(obj)
    {
        for(var i=1;i<=5;i++)
        {
            if(obj.id == ("td"+i))
            {
               obj.className = 'bodercolor';
               document.getElementById('tr' + i).style.display ='block';;
            }
            else
            { 
                if(document.getElementById('td' + i)){
                   document.getElementById('td' + i).className ='bodercolor1';
                   document.getElementById('tr' + i).style.display ='none';
                }
            }
         }
    }
}
function showDiv()
{
    document.getElementById('div1').style.display ='block';
}
function showElem(theBox)
{
    var string="";
    var elem=theBox.form.elements;
    for(i=0;i<elem.length;i++)
     {
          string += elem[i] + "  ";
     }
     alert(string);
}

function setvalue()
{
   //document.getElementById('hidfish').value = document.getElementById('sort1').value;     
   var arrfish=new Array('磯・堤防','沖','投げ','落とし込み','イカダ','ソルトウォーター','エギング','フライフィッシング','渓流','アユ','ヘラブナ','淡水大もの / 淡水小もの','バス','トラウト');    
   for(var i=0;i<arrfish.length;i++)
   {
      if(arrfish[i]==document.getElementById('fishi').value)
      {  
         document.getElementById('hidfish').value = 'type'+(i+1);
      }
   }                                 
}
function OnIntDropDown(id,str){
    var sel = document.getElementById(id);
    for(var i=0;i<sel.options.length;i++){
         if(sel.options[i].value == str)
           sel.selectedIndex = i;
    }
} 
function showDataOnMap(idx)
{ 
    map.setCenter(markerarr[idx].getPoint(),map.getZoom())
    GEvent.trigger(markerarr[idx],'click') ;
}

function openMailWindow()
{
    window.showModalDialog('../commpage/mailto.php',window,'dialogWidth:250px;dialogHeight:260px;');
}

function unCheckAll(tempControl)
{
    var theBox=tempControl;
    elem=theBox.form.elements;
    for(i=0;i<elem.length;i++)
    if(elem[i].type=="radio" && elem[i].id!=theBox.id)
    {
          elem[i].checked = "";
    }
}
function submitdata()
{
    document.frm.submit();
}

/*function deletefish(){
var xmlHttp;
var data = "data1=1";  
if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
    var xmlHttp = new XMLHttpRequest();
}
else if(window.ActiveXObject){ // For Internet Explorer
    var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open('POST', 'funayado.php', true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange = function(){
    if (xmlHttp.readyState == 4){
        alert('魚種による絞り込みを解除しました！');
    } 
}
xmlHttp.send(data);
}*/
function CheckNoSubmit(sel_shop)
{
    if(rdShop = document.getElementById('shoprd'))
    {
        if(rdShop.checked)
        {
            switch(sel_shop.selectedIndex)
            {
               case 0:
                   alert('選択ください');
               break;
               default:
                   document.frm.submit();
               break;  
            } 
        }
    }
    
}
function createXmlRequest()
{
    var xmlHttp;
    if(window.XMLHttpRequest)
    {
        xmlHttp = new XMLHttpRequest();
    }
    else if(window.ActiveXObject)
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return  xmlHttp;
}
function commNologin()
{
    alert('赤ピンへのコメント機能は、ログイン後に使用出来ます!');
}
 
