function setvodchannel(channelsb) {
	//var day=document.getElementById('day').options[document.getElementById('day').selectedIndex].value;
	//var monthyear=document.getElementById('monthyear').options[document.getElementById('monthyear').selectedIndex].value;
	window.location='index_logged.php?p=vod&channelid='+channelsb.options[channelsb.selectedIndex].value;//+'&fdate='+day+'.'+monthyear;
}
function setvoddate() {
	var channelid=document.getElementById('channelid').options[document.getElementById('channelid').selectedIndex].value;
	var day=document.getElementById('day').options[document.getElementById('day').selectedIndex].value;
	var monthyear=document.getElementById('monthyear').options[document.getElementById('monthyear').selectedIndex].value;
	window.location='index_logged.php?p=vod&channelid='+channelid+'&fdate='+day+'.'+monthyear;
}
function validatefaqform(formname) {
	var emailaddress=formname.emailaddress.value;
	var fullname=formname.fullname.value;
	var question=formname.question.value;
	if (isValidEmail(emailaddress)) {
		if (fullname=='') {
			alert('Please fill-in your Fullname');
			return false;
		} else {
			if (question=='') {
				alert('Please fill-in your Question');
				return false;
			} else {
				return true;
			}
		}
	} else {
		alert('Invalid email address');
		return false;
	}
}
function setTimeoutSession() { 
	window.location='subscription.php';
}
function supportsubject(object) {
	if (object.selectedIndex==2) {
		document.getElementById('nontechsupport').style.display='none';
		document.getElementById('techsupport').style.display='';
	} else {
		document.getElementById('nontechsupport').style.display='';
		document.getElementById('techsupport').style.display='none';
	}
}
function tick(time_difference, format) {
  Today = new Date(new Date().getTime() - time_difference);

  minutes = Today.getMinutes();
  if(minutes < 10)
    minutes = '0' + minutes;

  seconds = Today.getSeconds();
    if(seconds < 10)
      seconds = '0' + seconds;

         
  var clock = document.getElementById('clock');
  switch(format) {
    case 0:
      clock.innerHTML = Today.getHours()-7 + ':' +
                                     minutes + ':' +
                                     seconds;
      break;
    case 1:
      clock.innerHTML = Today.getHours()-7 + ':' +
                                     minutes + ':' +
                                     seconds;
      break;
    default:
      clock.innerHTML = Today.getHours()-7 + ':' +
                                     minutes + ':' +
                                     seconds;
   }
   setTimeout('tick(' + time_difference + ', ' + format + ');', 1000);
}
         
function displayhidefp() {
	if (document.getElementById('tab_forgotpassword').style.display!='block') {
	  document.getElementById('tab_forgotpassword').style.display='block';
 	  document.getElementById('tab_login').style.display='none';
	} else {
	  document.getElementById('tab_forgotpassword').style.display='none';
 	  document.getElementById('tab_login').style.display='block';
	}
}
function displayhidecp() {
	if (document.getElementById('tab_changepassword').style.display!='block') {
	  document.getElementById('tab_changepassword').style.display='block';
 	  document.getElementById('tab_login').style.display='none';
	} else {
	  document.getElementById('tab_changepassword').style.display='none';
 	  document.getElementById('tab_login').style.display='block';
	}
}
function validatephone(e) {
   	var key;
	if(window.event) // IE
	  {
	  key = e.keyCode;
	  }  
	else if(e.which) // Netscape/Firefox/Opera
	  {
	  key = e.which;
	  }
    // Key 8 - Backspace
    // Key 17 - Ctrl
    // Key 107 - + Sign
    // Key 9 - Tab
    // Key 46 - Delete
    // Key 111 - / Sign
    // Key 32 - Space
    // Key 188 - Comma
    // Key 16 - Shift
    // Key 189 - Dash 
    // Key 35 - Home
    // Key 36 - End
    // Keys 48-57 and 97-105 - Numeric Digits
    if ((key <48 || key >57)&&(key<95 || key>105 )&&(key!=8)&&(key!=46)&&(key!=111)&&(key!=32)&&(key!=37)&&(key!=35)&&(key!=36)&&(key!=39)&&(key!=188)&&(key!=189)&&(key!=16)&&(key!=9)&&(key!=107))
      {
		 if (window.event) //IE
			window.event.returnValue = false;     
		else //Firefox
			e.preventDefault();

	  }
}
function submitregistrationform() {
	var email=document.getElementById('regemail').value;
	var password=document.getElementById('regpassword').value;
	var phone=document.getElementById('regphone').value;
	var confirmpassword=document.getElementById('regconfirmpassword').value;
	var emailconfirm=isValidEmail(email);
	var acceptterms=document.getElementById('acceptterms').checked;
	
	if (emailconfirm) {
		if (phone.length<10) {
			alert('Please enter a valid Telephone number');
		} else {
			if (password.length<6) {
				alert('Password must contain at least 6 chars');
			} else {
				if (password!=confirmpassword) {
					alert('Passwords do not match');
				} else {
					if (acceptterms==false) {
						alert('Please accept the Terms and Conditions');
					} else {
						//window.location='http://update.rayv.com/viewer/getnewestversion/setup?affiliate=seelithuania';
						//document.cookie='emailaddress='+email;
						//document.cookie='password='+password;
						//window.location='download.php';
						document.getElementById('registrationf').submit();
					}
				}
			}
		}
	} else {
		alert('Please enter a valid Email address');
	}
}
function verifyPW() {
	document.getElementById('dopwrm').submit();
}
function submPWCH() {
	document.getElementById('dopwch').submit();
}
function verifyLogin() {
	var login_password=document.getElementById('login_password').value.length;
	if (login_password<6) {
	  alert('Password must contains 6 chars');
	} else {
	  document.getElementById('doLogin').submit();
	}
}
function psubmitform(formname) {
	document.getElementById(formname).submit();
}

function isValidEmail(str) {
   return (str.indexOf(".") > 0) && (str.indexOf("@") > 0);
}
function createpassword(display) {
	if (display==0) {
		document.getElementById('whitebackground').style.display='none';
	} else {
		document.getElementById('whitebackground').style.display='block';
	}
}
function setpackage(packageid) {
	if (packageid=='9') {
		document.getElementById('item_name_1').value='Premium 9 Channels for 30 Days';
		document.getElementById('item_amount_1').value='6.95';
		document.getElementById('total_amount').value='6.95';
	} else {
		document.getElementById('item_name_1').value='Premium 13 Channels for 30 Days';
		document.getElementById('item_amount_1').value='11.95';
		document.getElementById('total_amount').value='11.95';
	}
}
function confirmupdateaccessform() {
	var email=document.getElementById('dopw_email').value;
	var password=document.getElementById('dopw_password').value;
	var confirmpw=document.getElementById('dopw_confirmpassword').value;
	if (isValidEmail(email)) {
		if (password.length<6) {
			alert('Password must contain at least 6 chars');
		} else {
			if (password==confirmpw) {
			  document.getElementById('doPW').submit();
			} else {
				alert('Passwords do not match');
			}
		}
	} else {
		alert('Email not valid');
	}
}
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

