// JavaScript Document

function Inint() {

   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE

   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE

   try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript

   alert("XMLHttpRequest not supported");

   return null;

};


function shiftPartnershipTerms(src,sel){
	
	var s = document.getElementById(sel).value;
	
	if(s=='Gold'){
		
		document.getElementById(src).innerHTML='<p>Topworld.com, a World wide Travel Business Company located at Bryne, Norway, is the number one provider of an online booking system which all partner hotels can make their rooms\' availability and rates available for reservation purposes, which all interested guests can easily make or even cancel their reservations to any of their desired hotels through that online booking system. Topworld.com is very much ready to include all the relating information of our partner hotels on our website so that all guests will be able to make an online reservation for their accomodation of the hotel.</p><p><ol type="1"><li>payment is Paypal to Paypal</li><li>Publish/rack rate on rooms which mean 12 % is included on every room rate.</li><li>Once a costumer/guest makes a reservation, an email confirmation or reservation notification will immediately sent to your email and also to topworld and once a confirmation or notification is received, the hotel will automatically close the rooms.</li><li>Topworld.com will provide your hotel with a database or online facility, which the hotel can update it\'s information which reservations are made through the website.</li></ol></p><p>Partner hotels are liable for providing  Topworld.com with the information needed on the Websites such as rooms for reservation, rates and availability and also the cancellation policies. And the hotel is responsible for making sure that all the information provided by them is accurate and of course, updated. The Hotel should assure that topworld.com is not liable to any claim made against the website to any incorrect or wrong information or any other claims related to the services provided by the hotel. Complaints by the guests are shouldered by the Hotel.</p><p>Topworld.com allows its hotel partners to access the Topworld.com extranet that enables hotels to update online room availability, rates, pictures, texts and last minute inventory. The hotel also has a priveledge to find the number of visitors, conversion of rates, number of reservations and the commission to be paid. When the agreement with the both sides is done, partner hotels are provided with a unique username and password that the partner hotels can access the Extranet and that, the hotels must guarantee that the username and password are confidential and are kept within them at all times, the hotels must inform Topworld.com if there are suspected security violations at all cost. Topworld.com recommends all partner hotels to check from time to time the Extranet so that they will be aware if there are newly received reservations.</p><p>Online Hotel Reservations<br>Upon having the information of the hotel added to the Website, the hotel offers the guests the opportunity to make a reservation to the Website where appropriate for other services of the hotel. Accomodation Agreement will be created between the Hotel and the Guest once the Guest makes a reservation through the website. The hotel should grant Topworld.com clear authorization to conclude Accomodation Agreements on its behalf of online reservations for the hotel made by guests via the website. The hotel should handle the online reservation in the fullfillment with the information provided to the website at the time when the reservation was made. The hotel will receive an email confirmation or notification for every booking made via Topworld.com and that, Topworld.com is not responsible for any correctness of the information and also the dates provided by the guest as well as his/her payment obligations in relation to the online reservation he/she made.</p><p>The Hotel is obliged to make available minimum number of rooms available and bookable by the guest via the website. It is also the duty of the hotel to add and load availability of rooms for the guest\'s desired span of time through Extranet.</p><p>The Hotel will pay Topworld.com a commission of 12% based on the sales and other components as stated by the hotel on the website, except of course in the case of cancellation made by the guest.  The minimum commission percentage is agreed separately between Topworld.com and the hotel in the Hotel Agreement. In addition to that, the hotel can also increase the commission percentage in order to acquire higher ranking.</p><p>Guest\'s comments and reviews are highly appreciated by Topworld.com, that is Topworld.com asks the guest to leave their comments on their stay at the hotel and also to include the rating of their stay in the hotel and the hotel recognizes that Topworld.com is in fact not the one who published the said comments.</p><p>Topworld.com may advertise the hotel using it\'s name in online marketing process, and it can only be done with the approval the hotel.</p><p>Upon the completion of the requirements for the partnership, signed copy of the Hotel Agreement, Topworld.com will review this Agreement to participate in the service. Will Topworld.com accept the hotel\'s participation in the service, this agreement will begin on the date of the acceptance email that had been sent by the Topworld.com to the hotel. This agreement will still impart unless either of the party will terminate it in accordance with this conditions: Either the hotel or Topworld.com may end the Agreement or suspend the hotel from the service without notice in case of any fall foul done by the hotel e.g. delay of payment, insolvency, wrong information provided etc.) After the termination, the hotel will still be obliged to credit all  reservations made through the website preceeding to the date of termination, and will pay all commissions due to Topworld.com at reasonable costs.</p><p>Hotel and Topworld.com are not be liable for any incidental damages or economic loss even it is caused by violation of contract or even if the other party has been advised of the possibility of such damages. Agreement shall not exceed fifty percent (50%) of the commission due by the hotel to Topworld.com. It should be in a years time preceding such claim. Nothing in this Agreement shall exclude or limit any liability for personal injury or death caused by negligence or any liability for fraud.</p>';
	}else{
		document.getElementById(src).innerHTML='';
	}
}


function process(src, type){

	

		document.getElementById(src).innerHTML='<br><br><br><center><img src="assets/loading.gif"><br>Loading...</center><br><br><br>';

		var req = Inint();

		req.onreadystatechange = function () { 

		if (req.readyState==4) {

			if (req.status==200) {

				document.getElementById(src).innerHTML=req.responseText; 

			} 

		}

		 };

			 var url = "includes/pageLoad.php?type="+type+"&browseId="+Math.random();

			 

			 req.open("GET", url); 

			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1");     

			 req.send(null);

}



function process2(src, type){

	document.getElementById(src).innerHTML='<br><br><br><center><img src="assets/loading.gif"><br>Loading...</center><br><br><br>';

		

		var req = Inint();

		req.onreadystatechange = function () { 

		if (req.readyState==4) {

			if (req.status==200) {

				document.getElementById(src).innerHTML=req.responseText; 

			} 

		}

		 };

			 var url = "includes/loader.php?type=convention&browseId="+Math.random();

			 

			 req.open("GET", url); 

			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1");     

			 req.send(null);

}



function sendFlight(src, type){

	var curdate = document.getElementById('curdate').value;

	var date = document.getElementById('date').value;

	var from = document.getElementById('from').value;

	var to = document.getElementById('to').value;

	var name = document.getElementById('name').value;

	var email = document.getElementById('email').value;

	var contact = document.getElementById('contact').value;

	var reservation = document.getElementById('reservation').value;

	var cont = true;

	//alert(IsNumeric(contact));

	if(date.length>0 & from.length>0 & to.length>0 & name.length>0 & reservation.length>0 & email.length>0 & contact.length>0){	

		

		if(CheckEmail(email) == false){

			alert("Please make sure you have entered a valid email.");	

			cont = false;

		}

		if(!IsNumeric(contact) & contact.length>0 & cont == true){

			alert("Contact should be a number.");

			cont = false;	

		}

			

		if(cont==true){	

				

				

		document.getElementById(src).innerHTML='<br><br><br><center><img src="assets/loading.gif"><br>Loading...</center><br><br><br>';

		var req = Inint();

		req.onreadystatechange = function () { 

		if (req.readyState==4) {

			if (req.status==200) {

				document.getElementById(src).innerHTML=req.responseText; 

			} 

		}

		 };

		 	

	var l = "&date="+date+"&from="+from+"&to="+to+"&name="+name+"&reservation="+reservation+"&email="+email+"&contact="+contact+"&service="+type+"&curdate="+curdate;

			 var url = "includes/loader.php?type=send"+l+"&browseId="+Math.random();

			 

			 req.open("GET", url); 

			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1");     

			 req.send(null);

				

		}

	}else{

		alert("Please fill up all the fields.");	

	}

}



function sendFlight2(src, type){

	//var curdate = document.getElementById('curdate').value;

	//var date = document.getElementById('date').value;

	//var from = document.getElementById('from').value;

	//var to = document.getElementById('to').value;

	var name = document.getElementById('name').value;

	var email = document.getElementById('email').value;

	var contact = document.getElementById('contact').value;

	var reservation = document.getElementById('reservation').value;

	var cont = true;

	//alert(IsNumeric(contact));

	if(name.length>0 & reservation.length>0 & email.length>0 & contact.length>0){	

		

		if(CheckEmail(email) == false){

			alert("Please make sure you have entered a valid email.");	

			cont = false;

		}

		if(!IsNumeric(contact) & contact.length>0 & cont == true){

			alert("Contact should be a number.");

			cont = false;	

		}

			

		if(cont==true){	

				

				

		document.getElementById(src).innerHTML='<br><br><br><center><img src="assets/loading.gif"><br>Loading...</center><br><br><br>';

		var req = Inint();

		req.onreadystatechange = function () { 

		if (req.readyState==4) {

			if (req.status==200) {

				document.getElementById(src).innerHTML=req.responseText; 

			} 

		}

		 };

		 	

	var l = "&name="+name+"&reservation="+reservation+"&email="+email+"&contact="+contact+"&service="+type;

			 var url = "includes/loader.php?type=send2"+l+"&browseId="+Math.random();

			 

			 req.open("GET", url); 

			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1");     

			 req.send(null);

				

		}

	}else{

		alert("Please fill up all the fields.");	

	}

}



function sendFlight2(src, type){

	//var curdate = document.getElementById('curdate').value;

	//var date = document.getElementById('date').value;

	//var from = document.getElementById('from').value;

	//var to = document.getElementById('to').value;

	var name = document.getElementById('name').value;

	var email = document.getElementById('email').value;

	var contact = document.getElementById('contact').value;

	var reservation = document.getElementById('reservation').value;

	var cont = true;

	//alert(IsNumeric(contact));

	if(name.length>0 & reservation.length>0 & email.length>0 & contact.length>0){	

		

		if(CheckEmail(email) == false){

			alert("Please make sure you have entered a valid email.");	

			cont = false;

		}

		if(!IsNumeric(contact) & contact.length>0 & cont == true){

			alert("Contact should be a number.");

			cont = false;	

		}

			

		if(cont==true){	

				

				

		document.getElementById(src).innerHTML='<br><br><br><center><img src="traveler/assets/loading.gif"><br>Loading...</center><br><br><br>';

		var req = Inint();

		req.onreadystatechange = function () { 

		if (req.readyState==4) {

			if (req.status==200) {

				document.getElementById(src).innerHTML=req.responseText; 

			} 

		}

		 };

		 	

	var l = "&name="+name+"&reservation="+reservation+"&email="+email+"&contact="+contact+"&service="+type;

			 var url = "includes/loader.php?type=send2"+l+"&browseId="+Math.random();

			 

			 req.open("GET", url); 

			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1");     

			 req.send(null);

				

		}

	}else{

		alert("Please fill up all the fields.");	

	}

}



function IsNumeric(strString) {

   //  check for valid numeric strings	

  

   var strValidChars = "0123456789.,-#+/";

   var strChar;

   var blnResult = true;



   if (strString.length == 0) return false;



   //  test strString consists of valid characters listed above

   for (i = 0; i < strString.length && blnResult == true; i++)

      {

      strChar = strString.charAt(i);

      if (strValidChars.indexOf(strChar) == -1)

         {

         blnResult = false;

         }

      }

   return blnResult;

}



function CheckEmail(email){

    var firstchunk,indx,secondchunk;



    if (email == ""){

        //alert("Please make sure you have entered a valid email.");



        return false;

    }



    //get the zero-based index of the "@" character

    indx = email.indexOf("@");



    //if the string does not contain an @ then then return true

    if (indx == -1 ){



       // alert("Please make sure you have entered a valid email.");



        return false;

    }



    //if the first part of email is < 2 chars and second part < 7 chars

    //(arbitrary but workable criteria) then reject the input address



    firstchunk = email.substr(0,indx); //up to but not including the "@"



    //start at char following the "@" and include up to end of email addr

    secondchunk = email.substr(indx + 1); 



    //if the part  following the "@" does not include a period "." then

    //also return false

    if ((firstchunk.length < 2 ) || (secondchunk.length < 7) ||

    (secondchunk.indexOf(".") == -1)){ 



    //alert("Please make sure you have entered a valid email.");



    return false;

	}

	return true;

}



function CheckEmail2(email, temp){

    var firstchunk,indx,secondchunk;



    if (email == ""){

        alert("Please make sure you have entered a valid email.");



        return false;

    }



    //get the zero-based index of the "@" character

    indx = email.indexOf("@");



    //if the string does not contain an @ then then return true

    if (indx == -1 ){



        alert("Please make sure you have entered a valid email.");



        return false;

    }



    //if the first part of email is < 2 chars and second part < 7 chars

    //(arbitrary but workable criteria) then reject the input address



    firstchunk = email.substr(0,indx); //up to but not including the "@"



    //start at char following the "@" and include up to end of email addr

    secondchunk = email.substr(indx + 1); 



    //if the part  following the "@" does not include a period "." then

    //also return false

    if ((firstchunk.length < 2 ) || (secondchunk.length < 7) ||

    (secondchunk.indexOf(".") == -1)){ 



    alert("Please make sure you have entered a valid email.");



    return false;

	}

	return true;

}



function backMenu(src){

	document.getElementById(src).innerHTML='<br><br><br><center><img src="assets/loading.gif"><br>Loading...</center><br><br><br>';

		var req = Inint();

		req.onreadystatechange = function () { 

		if (req.readyState==4) {

			if (req.status==200) {

				document.getElementById(src).innerHTML=req.responseText; 

			} 

		}

		 };

		 	

	

			 var url = "includes/loader.php?type=backMenu";

			 

			 req.open("GET", url); 

			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1");     

			 req.send(null);

				

}



function subscribe(src){

	var letter_mail = document.getElementById('letter_mail').value;

	var temp = 0;

	if(CheckEmail2(letter_mail,temp)==true){

		document.getElementById(src).innerHTML='<br><br><br><center><img src="assets/ajax-loader.gif"><br>Loading...</center><br><br><br>';

		var req = Inint();

		req.onreadystatechange = function () { 

		if (req.readyState==4) {

			if (req.status==200) {

				document.getElementById(src).innerHTML=req.responseText; 

			} 

		}

		 };

		 	

	

			 var url = "includes/loader.php?type=insertEmail&email="+letter_mail;

			 

			 req.open("GET", url); 

			 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1");     

			 req.send(null);

				

	}

}





function submitCare(src){

	for (var i=0; i < document.radios.rad.length; i++){ //getting the values from radio

   			if (document.radios.rad[i].checked){

      			var rad_val = document.radios.rad[i].value;

      		}

  		}

    var otherSubject = document.getElementById('otherSubject').value;

	

	var fname = document.getElementById('fname').value;	

	var lname = document.getElementById('lname').value;

	var email = document.getElementById('email').value;

	var phone = document.getElementById('phone').value;

	var hotelName = document.getElementById('hotelName').value;

	var message = document.getElementById('message').value;

	var contCare = true;

	var subject='';

	

	//switch(rad_val){

			if(rad_val==1){

					subject = "Information on Topworld.com site";

			}

			

			if(rad_val==2){

					subject = "Hotel's contact details";	

			}

			

			if(rad_val==3){

					subject = "Group reservation (10 rooms and above)";	

			}

			

			if(rad_val==4){

					subject = "Information about a destination";	

			}

			

			if(rad_val==5){

					subject = "Feedback";	

			}

			

			if(rad_val==6){

					subject = otherSubject;

			}

	//	}

	

	var c = "&fname="+fname+"&lname="+lname+"&email="+email+"&phone="+phone+"&hotelName="+hotelName+"&subject="+subject+"&message="+message;

	



	if(email.length>0 & fname.length>0 & lname.length>0 & message.length>0){

			

			if(CheckEmail(email)==false){

			contCare=false;

			alert('Your email is invalid.');

			}

			if(contCare==true){

							document.getElementById(src).innerHTML='<br><br><br><center><img src="assets/ajax-loader.gif"><br>Loading...</center><br><br><br>';

				var req = Inint();

				req.onreadystatechange = function () { 

				if (req.readyState==4) {

					if (req.status==200) {

						document.getElementById(src).innerHTML=req.responseText; 

					} 

				}

				 };

					

			

					 var url = "includes/loadLib.php?type=insertCare"+c;

					 

					 req.open("GET", url); 

					 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1");     

					 req.send(null);

				}

		}

		else{

			alert("Some of the required fields are still empty.");

			}

	

    

}

