﻿// 王钊于 2011年5月4日 重新制作cruise-calendar添加必要js功能

function yjCruiseSailingDate(objID){var objFrame = document.getElementById("cruiseCalendar");var objInput = document.getElementById(objID);var eT=0,eL=0,p=objInput;var sT=document.body.scrollTop,sL=document.body.scrollLeft;var eH=objInput.height,eW=objInput.width;while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;}objFrame.style.top = ((document.body.clientHeight-(eT-sT)-eH>=objFrame.height)?eT+eH:eT-objFrame.height) + "px";objFrame.style.left = ((document.body.clientWidth-(eL-sL)>=objFrame.width)?eL-objInput.offsetWidth:eL+eW-objFrame.width) + "px";objFrame.style.display = "block";}function yjCloseCruiseSailing(){var objFrame = document.getElementById("cruiseCalendar");objFrame.style.display = "none";}function yjClickCruiseSailing(objValue,objTarget){if(parent.document.getElementById(objTarget)){parent.document.getElementById(objTarget).value = objValue;}if(parent.document.getElementById("cruiseCalendar")){parent.document.getElementById("cruiseCalendar").style.display = "none";}}function yjShowShipMap(objDiv,vInt){var objShipMap = document.getElementById("showShipMap");var eT=0,eL=0,p=objDiv;var sT=document.body.scrollTop,sL=document.body.scrollLeft;var eH=24,eW=130;while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;}objShipMap.style.top = (eT-130) + "px";objShipMap.style.left = ((document.body.clientWidth-(eL-sL)>=300)?eL-objDiv.offsetWidth+50:eL+eW-300) + "px";document.getElementById("showShipMapImage").setAttribute("src",yjSailings[vInt][1]);document.getElementById("showShipMapImageLink").setAttribute("href",yjSailings[vInt][8]);document.getElementById("cruiseShipMapShipName").innerHTML = "<a href='"+yjSailings[vInt][8]+"'>"+yjSailings[vInt][0]+"</a>";document.getElementById("cruiseShipMapStars").innerHTML = "";for(var i=0;i<yjSailings[vInt][2];i++){document.getElementById("cruiseShipMapStars").innerHTML += "<img src=\"../images/bg/star2.gif\" alt=\"\" />";}document.getElementById("cruiseShipMapShipRoute").innerHTML = yjSailings[vInt][3];document.getElementById("cruiseShipMapDate").innerHTML = yjSailings[vInt][5];document.getElementById("cruiseShipMapDirection").innerHTML = "UD$ " + yjSailings[vInt][6] + " &nbsp; " + yjSailings[vInt][7];document.getElementById("cruiseShipMapDetail").setAttribute("href",yjSailings[vInt][8]);document.getElementById("cruiseShipMapBook").setAttribute("href","javascript:yjCruiseEasyBooking('"+yjSailings[vInt][4]+"','"+yjSailings[vInt][0]+"')");objShipMap.style.display = 'block';}function yjHiddenShipMap(){document.getElementById("showShipMap").style.display = 'none';}function yjCruiseEasyBooking(vDate,vName){var objForm = document.getElementById("formCruiseBooking");objForm.TextBox_SailingDate.value = vDate;objForm.TextBox_ShipName.value = vName;objForm.submit();}function yjShowDesignateShip(vShipName){var objTable = document.getElementById("objCalendarTable");var arrDivs = objTable.getElementsByTagName("div");for(var i=0;i<arrDivs.length;i++){if(arrDivs[i].getElementsByTagName("span").length > 0){arrDivs[i].className = (arrDivs[i].getElementsByTagName("a")[0].innerHTML == vShipName) ? "cruiseCalendarShipGroup_Spc" : "cruiseCalendarShipGroup";}}}function yjNewCruiseTour(objID,objHeight){var objDiv = document.getElementById(objID);var cruiseSessionTime = 12;var speed = 100;var stopPoint = 0;var MyMargin;var objCount = objDiv.getElementsByTagName("img").length;var objNum = 0;var objMar = 0;function cruisetourset(){cruiseSessionTime = 8;objNum++;if (objNum >= objCount){objNum = 0;}stopPoint = 0 - objNum * objHeight;var MyMarSession;try{clearInterval(MyMarSession);}catch(e){}function cruisetourdo(){if (cruiseSessionTime > 0){objMar = parseInt(objDiv.style.marginTop.replace("px",""));objDiv.style.marginTop = (objMar - parseInt((objMar - stopPoint) / 2)) + "px";cruiseSessionTime--;}else{objDiv.style.marginTop = stopPoint + "px";clearInterval(MyMarSession);}}MyMarSession = setInterval(function(){cruisetourdo();},speed);}MyMargin = setInterval(function(){cruisetourset();},5000);}function yjShowCruiseList(objYear,objMonth){var objDiv = document.createElement("div");var objDiv1 = document.createElement("div");var objDiv2 = document.createElement("div");var objSel = document.getElementById("HiddenField_Ship").value;var objShip = document.getElementById("DropDownList_ShipName").value;var objUrl = "/yjfunction/yj-ajax-cruise-list.aspx?y=" + objYear + "&m=" + objMonth + "&s=" + objSel + "&ship=" + objShip;var xmlHttpRequest;objDiv.id = "yjAjaxBackground";objDiv1.id = "yjAjaxShowPanelBack";objDiv2.id = "yjAjaxShowPanel";objDiv.className = "newCruiseShipListPanelBg";objDiv1.className = "newCruiseShipListPanelB2";objDiv2.className = "newCruiseShipListPanel";objDiv.style.height = document.body.offsetHeight + "px";objDiv2.innerHTML = '<div class="newCruiseAJShipTitle"><img src="/images/theme/destinations/photoalbum/images_14.gif" alt="Close Book Panel" onclick="yjCloseAjaxBookForm();" /><span>Discover China Tours - Yangtze Cruises List - Loading!</span></div><div class="newCruiseAJShipNotice"><span class="newCruiseAJShipNotice3">The Yangtze Cruise list is <label>Loading</label> , Please wait...</span></div>';document.body.appendChild(objDiv);document.body.appendChild(objDiv1);document.body.appendChild(objDiv2);yjAjaxBookFormAuto();xmlHttpRequest = createXmlHttpRequest();xmlHttpRequest.onreadystatechange = yjHtmlShow;xmlHttpRequest.open("get",objUrl,true);xmlHttpRequest.send(null);function yjHtmlShow(){if(xmlHttpRequest.readyState == 4){if(xmlHttpRequest.status == 200){objDiv2.innerHTML = xmlHttpRequest.responseText;}}}}function yjAjaxBookFormAuto(){var objDiv = document.getElementById("yjAjaxShowPanel");var objDiv1 = document.getElementById("yjAjaxShowPanelBack");var MyCloseSession;var w = document.body.offsetWidth;var s = window.screen;var t,l;if (objDiv){MyCloseSession = setInterval(function(){yjAutoBookForm()},100);}else{clearInterval(MyCloseSession);}function yjAutoBookForm(){try{t = document.documentElement.scrollTop;t = t + (s.availHeight - objDiv.offsetHeight) / 4;l = (w - objDiv.offsetWidth) / 2;objDiv1.style.height = objDiv.offsetHeight + "px";objDiv1.style.width = objDiv.offsetWidth + "px";objDiv.style.top = t + "px";objDiv.style.left = l + "px";t += 5;l += 4;objDiv1.style.top = t + "px";objDiv1.style.left = l + "px";}catch(e){clearInterval(MyCloseSession);}}}function yjCloseAjaxBookForm(){var objDiv = document.getElementById("yjAjaxShowPanel");var objDiv1 = document.getElementById("yjAjaxShowPanelBack");var objDiv2 = document.getElementById("yjAjaxBackground");document.body.removeChild(objDiv);document.body.removeChild(objDiv1);document.body.removeChild(objDiv2);}function yjCruiseSeleted(obj){var xmlHttpRequest;var objUrl = "/yjfunction/yj-ajax-cruise-list.aspx?sesn=" + obj.value + "&tmp=" + (11111 + Math.round(Math.random() * 99999));document.getElementById("DropDownList_ShipName").value = obj.value;yjShowDesignateShip(obj.value);xmlHttpRequest = createXmlHttpRequest();xmlHttpRequest.open("get",objUrl,true);xmlHttpRequest.send(null);yjCloseAjaxBookForm();}function yjCruiseListChg(intChg,objYear,objMonth){document.getElementById("HiddenField_Ship").value = intChg;var objShip = document.getElementById("DropDownList_ShipName").value;var objDiv = document.getElementById("yjAjaxShowPanel");var objUrl = "/yjfunction/yj-ajax-cruise-list.aspx?y=" + objYear + "&m=" + objMonth + "&s=" + intChg + "&ship=" + objShip;var xmlHttpRequest;objDiv.innerHTML = '<div class="newCruiseAJShipTitle"><img src="/images/theme/destinations/photoalbum/images_14.gif" alt="Close Book Panel" onclick="yjCloseAjaxBookForm();" /><span>Discover China Tours - Yangtze Cruises List - Loading!</span></div><div class="newCruiseAJShipNotice"><span class="newCruiseAJShipNotice3">The Yangtze Cruise list is <label>Loading</label> , Please wait...</span></div>';xmlHttpRequest = createXmlHttpRequest();xmlHttpRequest.onreadystatechange = yjHtmlShow;xmlHttpRequest.open("get",objUrl,true);xmlHttpRequest.send(null);function yjHtmlShow(){if(xmlHttpRequest.readyState == 4){if(xmlHttpRequest.status == 200){objDiv.innerHTML = xmlHttpRequest.responseText;}}}}
