// Destination.js


function display(id,noOfLocation)
{
for(var a=0;a<=noOfLocation;a++)
{
if(id==('locationID'+a))
{
    if (document.getElementById(id).style.display == 'none')
    { // DOM3 = IE5, NS6
    document.getElementById(id).style.display = '';
    document.getElementById("href"+id).innerHTML = '(-)';
    }
    else
    {
    document.getElementById(id).style.display = 'none';
    document.getElementById("href"+id).innerHTML = '(+)';
    }
}
else
{
    document.getElementById(('hreflocationID'+a)).innerHTML = '(+)';
    document.getElementById(('locationID'+a)).style.display = 'none';
}
}
}

function iframe_onload()
{
var theWaitCell = document.getElementById('Wait1');
theWaitCell.style.visibility = "hidden";
}
//
function destinationWidget(tourismWidgeCodetArray,tourismWidgeNametArray)
{ 	 
		   var travellerReview=document.getElementById("travellerReview");
           var locationID="";
           var locationNameID="";
           var moreflag="";
           var display="";
           var frame="";
           var xmlstr="<table>";

           /*for(var i=0;i<tourismWidgeCodetArray.length;i++)
           {
               if(i==0) {moreflag="(-)";display="''";}
               locationID=tourismWidgeCodetArray[i];
               locationNameID=tourismWidgeNametArray[i];
               frame=frame+"<tr><td colspan=\"2\">"+locationNameID+"<a id=\""+("href"+('locationID'+i))+"\" style=\"color:#0033ff; font:bold 12px arial;\"  href=\"javascript:display('"+('locationID'+i)+"',"+(tourismWidgeCodetArray.length-1)+")\">"+moreflag+"</a></td></tr>";
               frame=frame+"<tr><td colspan=\"2\"><iframe style=\"display:"+display+";\" id=\""+('locationID'+i)+"\" src=\"http://www.tripadvisor.com/WidgetEmbed-cdsdestwide?display=true&locationId="+locationID+"&lang=en_UK&partnerId=TestP1\" width=\"468\" height=\"450\" scrolling=\"no\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" ></iframe></td></tr>";
               moreflag="(+)";
               display="none";
           }
           xmlstr=xmlstr+frame+"</table>";
           travellerReview.innerHTML=xmlstr;
		   */
		   document.getElementById('Wait1').style.visibility="visible";
		   frame="<tr><td>";
		   for(var j=0;j<tourismWidgeCodetArray.length;j++)
           {
               if(j==0) {moreflag="(-)";}
               locationID=tourismWidgeCodetArray[j];
               locationNameID=tourismWidgeNametArray[j];
               frame=frame+locationNameID+"<a id=\""+("href"+('locationID'+j))+"\" style=\"color:#0033ff; font:bold 12px arial;\"  href=\"javascript:display('"+('locationID'+j)+"',"+(tourismWidgeCodetArray.length-1)+")\">"+moreflag+"</a>&nbsp;&nbsp;&nbsp;&nbsp;";
               moreflag="(+)";
           }
		   frame=frame+"</td></tr>";
		   for(var i=0;i<tourismWidgeCodetArray.length;i++)
           {
               if(i==0) {display="''";}
               locationID=tourismWidgeCodetArray[i];
               locationNameID=tourismWidgeNametArray[i];
               frame=frame+"<tr><td colspan=\"2\"><iframe onload=\"iframe_onload();\" style=\"display:"+display+";\" id=\""+('locationID'+i)+"\" src=\"http://www.tripadvisor.com/WidgetEmbed-cdsdestwide?display=true&locationId="+locationID+"&lang=en_UK&partnerId=TestP1\" width=\"468\" height=\"450\" scrolling=\"no\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" ></iframe></td></tr>";
			   display="none";
           }
           xmlstr=xmlstr+frame+"</table>";
           travellerReview.innerHTML=xmlstr;
}
//



function destinationWidgetAjax(pkg)
{
        
        document.getElementById('Wait1').style.visibility="visible";
        var NWID=document.getElementById("travellerReview");
        var xmlHttp;
        try
        {  // Firefox, Opera 8.0+, Safari
         xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {  // Internet Explorer
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
                try
                {
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e)
                {
                    alert("Your browser does not support AJAX!");
                    return false;
                }
            }
        }
        xmlHttp.onreadystatechange=function()
        {
            if(xmlHttp.readyState==4)
            {
                NWID.innerHTML=xmlHttp.responseText;
            }
        }
		var a="http://www.railtourismindia.com/cgi-bin/dev1.dll/irctc/common/ajaxDataProvider.jsp?pkg="+pkg;
        xmlHttp.open("post",a,true);
        xmlHttp.send(null);
}