function jumpto(theurl) {
	window.location.href = theurl;
}

function openpopup() {
	var popurl	= "http://www.eaglepro.net/xpeedometer_eng/xpeedometer.htm";
	winpops		= window.open(popurl, "", "width=520,height=400,");
}

function opensubmitter() {
	var popurl	= "http://www.monster-submit.com/resources/submit/index.php";
	winpops		= window.open(popurl, "", "width=800,height=400,resizable=1,scrollbars=1");
}

function emailpage() {
	mail_str = "mailto:?subject=Email Recommendation: " + document.title;
	mail_str += "&body=I recommend you check out the following page [" + document.title + "] at the ";
	mail_str += "Virtual Solutions website -- " + location.href; 
	location.href = mail_str;
}

function translatepage() {
	var url		= ("http://babel.altavista.com/?url=" + location.href);
	day		= new Date();
	id		= day.getTime();
	eval("file" + id + " = window.open(url, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1');");
}
var newwindow;
function poptastic(url){
	newwindow=window.open(url,'name','height=400,width=200,left=20,top=20,toolbar=no,menubar=no,directories=no,location=no,scrollbars=no,status=no,resizable=yes,fullscreen=no');
	if (window.focus) { newwindow.focus(); }
}
function gotoURL(form) {
	var newIndex = form.url.selectedIndex;
	if (newIndex != 0) {
		if (newIndex != 1) { window.open(form.url.options[newIndex].value); }
		else {
			parent.focus();
			parent.location.href	= form.url.options[newIndex].value;
		}
	}
}
function preload() {
	parent.focus();
	parent.location.reload();
}
function pprint() {
	parent.focus();
	parent.print();
}
function pemail() {
	var url			= top.location;
	var title		= top.document.title;
	mail_str		= "mailto:?subject=Email Recommendation: " + title;
	mail_str		+= "&body=I recommend you check out the following page [" + title + "] at the ";
	mail_str		+= "Virtual Solutions website : " + url;
	location.href	= mail_str;
}
function pbookmark() {
	var url			= top.location;
	var title		= top.document.title;
	var regEx		= / : /gi;
	var ntitle		= title.replace(regEx, "-");
	if (window.sidebar) { window.sidebar.addPanel(ntitle, url, ""); }
	else if( document.all ) { window.external.AddFavorite(url, ntitle); }
	else { alert("Your browser doesn't support this"); }
}
function pcomment() {
	var url			= top.location;
	url				= "/scripts/comments/comments.cgi?" + url;
	parent.location.href	= url;
}
function openMenu(url, name) {
	var temp		= "";
	url				= '' + url;
	splitstring		= url.split(" ");
	for(i = 0; i < splitstring.length; i++) {
		if (i > 0) { temp = temp + '_' + splitstring[i]; }
		else { temp = splitstring[i]; }
	}
	url				= temp;
	window.open(url, name, 'scrollbars=1,resizable=no,width=200,height=300,status=0,menubar=0');
}
function openMap(url, name) {
	var temp	= "";
	url			= '' + url;
	splitstring	= url.split(" ");
	for(i = 0; i < splitstring.length; i++) {
		if (i > 0) { temp = temp + '_' + splitstring[i]; }
		else { temp = splitstring[i]; }
	}
	url			= temp;
	window.open(url, name, 'scrollbars=1,resizable=no,width=550,height=450,status=0,menubar=0');
}
$(function() {
    $('#text-search').bind('keyup change', function(ev) {
        // pull in the new value
        var searchTerm = $(this).val();

        // remove any old highlighted terms
        $('body').removeHighlight();

        // disable highlighting if empty
        if ( searchTerm ) {
            // highlight the new term
            $('body').highlight( searchTerm );
        }
    });
});
function openPopup(url, name) {
	var temp	= "";
	url			= '' + url;
	splitstring	= url.split(" ");
	for(i = 0; i < splitstring.length; i++) {
		if (i > 0) { temp = temp + '_' + splitstring[i]; }
		else { temp = splitstring[i]; }
	}
	url			= temp;
	window.open(url, name, 'scrollbars=1,resizable=no,width=1000,height=450,status=0,menubar=0');
}
function openPage(url, width, height) {
	var temp	= "";
	url			= '' + url;
	width		= '' + width;
	height		= '' + height;
	splitstring	= url.split(" ");
	for(i = 0; i < splitstring.length; i++) {
		if (i > 0) { temp = temp + '_' + splitstring[i]; }
		else { temp = splitstring[i]; }
	}
	url			= temp;
	window.open(url, name, 'scrollbars=1,resizable=no,width=' + width + ',height=' + height + ',status=0,menubar=0');
}
ddaccordion.init({
	headerclass: "menuheaders", //Shared CSS class name of headers group
	contentclass: "menucontents", //Shared CSS class name of contents group
	revealtype: "clickgo", //Reveal content when user clicks or onmouseover the header? Valid value: "click", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["unselected", "selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
	animatespeed: 500, //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})
var divid			= 'output';
var loadingmessage		= '<center><img src="/images/ajax_working.gif" border="0" alt="Processing" /></center>';
function AJAX(){
	var xmlHttp;
	try {
		xmlHttp	= new XMLHttpRequest();
		return xmlHttp;
	}
	catch (e) {
		try {
			xmlHttp	= new ActiveXObject("Msxml2.XMLHTTP");
			return xmlHttp;
		}
	catch (e) {
		try {
			xmlHttp	= new ActiveXObject("Microsoft.XMLHTTP");
			return xmlHttp;
		}
	catch (e) {
		alert("Your browser does not support AJAX!");
		return false;
	}
	}
	}
}
function formget(f, url) {
	if (document.getElementById('agree') != null) {
		if (document.getElementById('agree').checked == false) {
			alert('You must accept the terms and conditions as laid out in the License and Legals before you can make your purchase.');
			return false;
		}
	}
	var poststr	= getFormValues(f);
	postData(f, url, poststr);
}
function postData(f, url, parameters){
	var xmlHttp					= AJAX();
	xmlHttp.onreadystatechange	= function(){
		if (xmlHttp.readyState > 0 && xmlHttp.readyState < 4) {
			document.getElementById(divid).innerHTML	= loadingmessage;
		}
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.responseText.search("successbox") != -1) { f.reset(); }
			if (dopayment != 1) {
				if (document.getElementById('recaptcha_response_field') != null) {
					Recaptcha.reload();
				}
				var mySplitResult	= xmlHttp.responseText.split("|");
				for (i = 0; i < mySplitResult.length; i++) {
					var parts	= mySplitResult[i].split("::");
					if (parts[0] != 'output') {
						document.getElementById('span_' + parts[0]).innerHTML	= parts[1];
					}
					else {
						document.getElementById(parts[0]).innerHTML	= parts[1];
					}
				}
			}
			else {
				document.getElementById(divid).innerHTML	= xmlHttp.responseText;
			}
			return false;
		}
	}
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", parameters.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(parameters);
	if (document.getElementById('image') != null) {
		document.getElementById('image').src = 'http://www.password-sentry.com/captcha/securimage_show.php?sid=' + Math.random();
	}

	return false;
}
function getFormValues(fobj) {
	var str			= "";
	var valueArr	= null;
	var val			= "";
	var cmd			= "";
		for (var i = 0;i < fobj.elements.length;i++) {
		switch(fobj.elements[i].type) {
			case "checkbox":
				if (fobj.elements[i].checked) {
					str	+= fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
				}
				break;
			case "radio":
				if (fobj.elements[i].checked) {
					str	+= fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
				}
				break;
			case "text":
				str	+= fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
				break;
			case "submit":
				str	+= fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
				break;
			case "password":
				str	+= fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
				break;
			case "hidden":
				str	+= fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
				break;
			case "textarea":
				str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
				break;
			case "select-one":
 				str += fobj.elements[i].name + "=" + fobj.elements[i].options[fobj.elements[i].selectedIndex].value + "&";
				break;
		}
	}
	str	= str.substr(0, (str.length - 1));
	return str;
}

