
function changeType(){showdiv();var country=dijit.byId('cbCountry').attr('value');var VarUrl=rootUrl+'countries/json/type/country/'+country;var type_store=new dojo.data.ItemFileReadStore({url:VarUrl});dijit.byId('cbType').store=type_store;dijit.byId('cbType').store.fetch();dijit.byId('cbType').attr('value',0);dijit.byId('cbType').setDisplayedValue('2. Select an Option',false);changeTour();hidediv();}
function _OnFocus(txt,valor)
{if(dijit.byId(txt).attr('value')==valor)
{dijit.byId(txt).attr('value','');}}
function _OnBlur(txt,valor)
{if(dijit.byId(txt).attr('value')==valor||dijit.byId(txt).attr('value')=='')
{dijit.byId(txt).attr('value',valor);}}
function changeTour(){showdiv();var country=dijit.byId('cbCountry').attr('value');var type=parseInt(dijit.byId('cbType').attr('value'));switch(type){case 2:var VarUrl=rootUrl+'countries/json/bytheme/country/'+country;break;case 1:var VarUrl=rootUrl+'countries/json/bydestinity/country/'
+country;break;case 3:var VarUrl=rootUrl+'countries/json/bypromotion/country/'
+country;break;case 4:var VarUrl=rootUrl+'countries/json/byprice/country/'
+country;break;default:var VarUrl=rootUrl+'countries/json/bydestinity/country/'
+'0';}
var type_store=new dojo.data.ItemFileReadStore({url:VarUrl});dijit.byId('cbTour').store=type_store;dijit.byId('cbTour').store.fetch();dijit.byId('cbTour').attr('value',0);hidediv();}
function SubmitSearch(){var type=parseInt(dijit.byId('cbType').attr('value'));var destiny=parseInt(dijit.byId('cbTour').attr('value'));var country=parseInt(dijit.byId('cbCountry').attr('value'));switch(type){case 1:url=buildUrl(destiny,country);window.location.href=url;break;case 2:url=buildThemesUrl(destiny,country);window.location.href=url;break;case 3:url=buildUrl_2(country,destiny);window.location.href=url;break;case 4:url=buildUrl_3(country,destiny);window.location.href=url;break;default:url=rootUrl+getCountry(country);window.location.href=url;break;}}
function getCountry(country)
{var retorno=null;dojo.xhrPost({form:dojo.byId('frmCat'),url:rootdomain+'countries/index/getcountry/coui_id/'+country,handleAs:'text',preventCache:true,sync:true,timeout:50000,load:function(response,ioArgs){retorno=response;},error:function(response,error){console.debug("An error occurred with error: ",error);}});return retorno;}
function suscribe(){if(!dijit.byId('frmCat').validate()){dijit.byId('suscribe_mail').focus();return false;}
document.frmCat.action=rootUrl+'suscribe';document.frmCat.submit();return true;}
function quote(url){document.frmCat.action=url;document.frmCat.submit();}
function SubmitSearchAll(){dojo.byId('all').value='todos';document.frmCat.submit();}
function navigation(url){window.location=url;}
function hidediv(){if(document.getElementById){document.getElementById('hideshow').style.visibility='hidden';}else{if(document.layers){document.hideshow.visibility='hidden';}else{document.all.hideshow.style.visibility='hidden';}}}
function showdiv(){if(document.getElementById){document.getElementById('hideshow').style.visibility='visible';}else{if(document.layers){document.hideshow.visibility='visible';}else{document.all.hideshow.style.visibility='visible';}}}
function buildUrl(desi,couid){var retorno=null;try{x=dojo.xhrPost({url:rootUrl+'tours/json/getdestinyurl/destiny/'+desi+'/country/'+couid,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},handleAs:'text',preventCache:true,sync:true,timeout:50000,load:function(responseObject,ioArgs){console.log('Read JSON Data ... do something',responseObject);retorno=responseObject;},error:function(type,error){console.debug("An error occurred: ",error);}});}catch(err){console.debug("An error occurred: ",err);}
return retorno;}
function buildThemesUrl(desi,couid){var retorno=null;try{x=dojo.xhrPost({url:rootUrl+'tours/json/themesurl/promo/'+desi+'/country/'+couid,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},handleAs:'text',preventCache:true,sync:true,timeout:50000,load:function(responseObject,ioArgs){console.log('Read JSON Data ... do something',responseObject);retorno=responseObject;},error:function(type,error){console.debug("An error occurred: ",error);}});}catch(err){console.debug("An error occurred: ",err);}
return retorno;}
function buildUrl_2(cou,pro){var retorno=null;try{x=dojo.xhrPost({url:rootUrl+'tours/json/getpromourl/country/'+cou+'/promo/'+pro,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},handleAs:'text',preventCache:true,sync:true,timeout:50000,load:function(responseObject,ioArgs){console.log('Read JSON Data ... do something',responseObject);retorno=responseObject;},error:function(type,error){console.debug("An error occurred: ",error);}});}catch(err){console.debug("An error occurred: ",err);}
return retorno;}
function buildUrl_3(cou,pro){var retorno=null;try{x=dojo.xhrPost({url:rootUrl+'tours/json/getpriceurl/country/'+cou+'/price/'+pro,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},handleAs:'text',preventCache:true,sync:true,timeout:50000,load:function(responseObject,ioArgs){console.log('Read JSON Data ... do something',responseObject);retorno=responseObject;},error:function(type,error){console.debug("An error occurred: ",error);}});}catch(err){console.debug("An error occurred: ",err);}
return retorno;}
function sendLinkPartner(fromForm,fragmentURL){dojo.xhrPost({form:dojo.byId(fromForm),url:fragmentURL,handleAs:"text",load:function(response,ioArgs){window.location.href=rootdomain+'link-partner/thanks';return response;},error:function(response,ioArgs){alert("An error occurred, with response: "+response);return response;}});}
function loadFriend(url)
{dojo.parser.parse(dojo.byId('sendToFriend'));dijit.byId('sendToFriend').attr('href',url);dijit.byId('sendToFriend').show();}
function sendFriend(){if(!dijit.byId('my_name').isValid()){return false}
if(!dijit.byId('my_email').isValid()){return false}
if(!dijit.byId('your_name').isValid()){return false}
if(!dijit.byId('your_email').isValid()){return false}
dojo.xhrPost({form:dojo.byId('friendForm'),url:rootdomain+'tours/index/sendmailfriend',handleAs:"text",load:function(response,ioArgs){window.location.href=rootdomain+'send-friend/thanks';return response;},error:function(response,ioArgs){return response;}});}
function sendContact()
{if(!dijit.byId('frmCat').validate())
{return false;}
dojo.xhrPost({form:dojo.byId('frmCat'),url:rootdomain+'default/mail/sendcontactus',handleAs:"text",load:function(response,ioArgs){dojo.byId('frmCat').reset();window.location.href=rootUrl+'contact-us/thanks';},error:function(response,ioArgs){return response;}});}
function showBox(box)
{dijit.byId(box).show();}
function sendComment(bloi_id)
{if(!dijit.byId('frmCat').validate()){return false;}
dojo.xhrPost({form:dojo.byId('frmCat'),url:rootdomain+'blog/index/sendmailcomment/bloi_id/'+bloi_id,handleAs:"text",load:function(response,ioArgs){name=dijit.byId('name').attr('value');dijit.byId('commentMessage').setContent('<div class="tit-gene-18">Thank you '+name+' </div>We have received your comment and will be publishing it shortly.');dijit.byId('alertComment').show();dijit.byId('name').attr('value','');dijit.byId('email').attr('value','');dijit.byId('comment').attr('value','');return response;},error:function(response,ioArgs){return response;}});}
function sendOk()
{dijit.byId('frmCat').reset();dijit.byId('alertComment').hide();}
var flag=false;function wipe(id){if(flag){wipeOutOne(id);flag=false;}else{wipeInOne(id);flag=true;}}
function wipeInOne(hola){dojo.fx.wipeIn({node:hola,duration:300}).play();}
function wipeOutOne(hola){dojo.fx.wipeOut({node:hola,duration:300}).play();}
flag=false;function wipe(id){if(flag){wipeOutOne(id);flag=false;}else{wipeInOne(id);flag=true;}}
function wipeDiv(id){if(flag){wipeOutOne(id);flag=false;}else{wipeInOne(id);flag=true;}}
function wipeInOne(hola){dojo.fx.wipeIn({node:hola,duration:300}).play();}
function wipeOutOne(hola){dojo.fx.wipeOut({node:hola,duration:300}).play();}
