// JavaScript Document
var proto_pages = Array("index.php", "demos.php", "order.php", "", "test.php");
function parseUri (str) { var o = parseUri.options, m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), uri = {}, i = 14; while (i--) uri[o.key[i]] = m[i] || ""; uri[o.q.name] = {}; uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { if ($1) uri[o.q.name][$1] = $2;}); return uri;}; parseUri.options = { strictMode: false, key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], q: { name: "queryKey", parser: /(?:^|&)([^&=]*)=?([^&]*)/g
}, parser: { strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
}
};
var uri = parseUri(window.location.href);
function currentPage(which){
	document.getElementById('nav_'+which).className = 'current';
}
var screen_array = [{ },
					{
						bos: 1,
						img: 'r_distress.jpg',
						text: '“50% of companies that lose their data go out of business immediately and 90% do not survive more than two years.”',
						source: 'Businessweek.com'
					},
					{
						box: 2,
						img: 'r_happy.jpg',
						text: 'For years online backup services have either been unreliable, insecure, hard to use, or very expensive. <font color="blue">But that all has changed!</font>',
						source: ''
					},
					{
						box: 3,
						img: 'r_laptop.jpg',
						text: 'Out Of 1.08 billion computers, 6% of them will lose data due to hardware failure, human error, data corruption, viruses, theft, and natural disasters. <font color="red">Thats over 64 million computers.</font>',
						source: ''
					},
					{
						box: 4,
						img: 'r_servers.jpg',
						text: 'XZ Backup knows that ALL of your data is important. Thats why we provide you with the most reliable backup solution for your needs. <br /><font color="blue">Feel Safe With XZ Backup</font>',
						source: ''
					}
					];
var orderq = [
			  {
			  	txt: "<div align='justify'>A credit card is required for security reasons. A valid credit card allows us to verify a user's identity and avoid multiple sign-ups for free trial memberships. If you cancel your subscription at anytime during the free trial period, your credit card will not be charged. However, you will still be able to access your trial account for the duration of your free trial. If you decide to keep your XZ Backup Remote Backup plan, you will be automatically billed for the selected plan at the end of your trial period. Please contact us if you have questions.</div>"
			  },
			  {
			  	txt: "<div align='justify'>When your trial period has expired, the credit card on file from the time of signup will be charged according to the plan you selected when signing up. The Backup Service will continue to run unless the account could not be billed. If you do not wish to be billed please cancel before the trial period has ended.</div>"
			  },
			  {
			  	txt: "<div align='justify'><strong>Minutes!</strong> Your trial starts immediately from the completion of the signup process. The trial will end 30 days from the time it was started. </div>"
			  },
			  {
			  	txt: "<div align='justify'>You do not need to worry about converting the trial to a paid plan within the first 30 days as you are not missing out on any features. <strong>Please enjoy your 30 day FREE trial.</strong></div>"
			  }
			];
function preloader() 
{
	var imgs = {};
	for (var i=0;i<screen_array.length;i++){
			if (screen_array[i].img+"" == 'undefined'){
				continue;
			}
			imgs[i] = new Image();
			imgs[i].src = "https://www.xzbackup.com/_images/"+screen_array[i].img;
	}
}
function doBlur(ite, num){
	document.getElementById(num).value=ite.value;
}
var current = 1;
var timer= 0;
var on = 0;
var so = null;
var p = false;
var visible = false;
var old = false;
var jumped = false;
function pausecomp(millis)
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); }
	while(curDate-date < millis);
}

function doFinish(){
	if (on == 0){ return null; }
	Effect.toggle('screen_img', 'appear',{duration: 1});
	Effect.toggle('screen_content', 'appear',{duration: 1});
	if (current > screen_array.length-1){
		current = 0;
	} else if (jumped!=1) {
		current++;
	}
	on = 0;
}
function setCurrents(){
	for (var i=1;i<5;i++){
		var curr = $('nav_bar_'+i);
//		debugger;
		if (curr !== null){
			$('nav_bar_'+i).className = 'loc_box';
		}
	}
	$('nav_bar_'+current).className = 'loc_box_current';
}
function doUpdate(){
//	debugger;
	if (p == true){
		return null;
	}
	if (jumped == true){
		jumped = false;
		clearInterval(timer);
		timer = setInterval(doUpdate, 12000);
	} else if (jumped == false){
		if (current > screen_array.length-1){
			current = 1;
		} else {
			current++;
		}
	}
	
	if (old == false){
		doAppear();
		old = true;
		timer = setInterval(doUpdate, 12000);
		current = 1;
	} else if (screen_array[current]){
		setCurrents();
		doAppear();
		setTimeout(function(){
							$('scrimg').src="../_images/"+screen_array[current].img;
							$('screen_text').innerHTML = screen_array[current].text;
							$('screen_ref').innerHTML = screen_array[current].source;
							setTimeout(doAppear, 500);
							}, 1000);
		
	}
}
function doAppear(){
	Effect.toggle('screen_img', 'appear', {duration: 0.5});
	Effect.toggle('screen_content', 'appear',{duration: 0.5});
	visible = !visible;
}
function jumpTo(which){
		jumped = true;
		current = which;
		doUpdate();
}
function doPause(e){
	//debugger;
	if (p == false){
		p = true;
		e.innerHTML = "<img src='_images/pl.png' border='0'/>";
	} else if (p == true){
		p = false;
		e.innerHTML = "<img src='_images/p.png' border='0'/>";
	}
}
function showOrderQ(title, txt){
	if (Ext.Msg){
		if (orderq[txt]){
			txt = orderq[txt].txt;
		}
		Ext.Msg.show({
						 buttons: Ext.MessageBox.OK,
						 title: title,
						 msg: txt,
						 closable: true,
						 width: 400
						 
					 });
	}
}
function screen_setup(){
	preloader();
	doUpdate();
}