function confirmEULA(checkbox){
	el = this.document.getElementById('checkout_html');
	
	if (el){
		if (checkbox.checked)	{
			el.style.display = 'block';
		}else{
			el.style.display = 'none';
		}
	}
}

function checkEULA(checkbox){
	if (checkbox.checked)	{
		return true;
	}else{
		alert("You must agree to End User License Agreement in order to proceed.");
		return false;
	}
}

function checkAcceptedLicense(checkbox){
	if (checkbox.checked)	{
		return true;
	}else{
		alert("You must agree with all the terms of this commercial license agreement.");
		return false;
	}
}

function checkEnter(e,form_name){ //e is event object passed from function invocation
	var characterCode;// literal character code will be stored in this variable
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which;
	} else { // IE
		e = event;
		characterCode = e.keyCode;
	}

	if(characterCode == 13){ // ENTER
		document.forms[form_name].submit();
		return false;
	} else{
		return true;
	}
}



function reloadFrame(number,uri) {
	if(uri) {
		parent.frames[number-1].location.href = uri;
	}else {
		parent.frames[number-1].location.href = parent.frames[number-1].location.href;
	}
}

function toggleDivVisibility(id, force_value) {
	var el = this.document.getElementById(id);
	var el_toggler = this.document.getElementById(id + '_toggler');
	
	if (force_value != null) {
		if (force_value) {
			el.style.display = 'block';
			el_toggler.src = '/content/images/ticons/bullet_arrow_up.gif';
		} else {
			el.style.display = 'none';
			el_toggler.src = '/content/images/ticons/bullet_arrow_down.gif';
		}
		return '';
	}

	if (el){
		if (el.style.display == 'none') {
			el.style.display = 'block';
			el_toggler.src = '/content/images/ticons/bullet_arrow_up.gif';
			setCookie(id + '_toggler_on_off', 'on');
		} else {
			el.style.display = 'none';
			el_toggler.src = '/content/images/ticons/bullet_arrow_down.gif';
			setCookie(id + '_toggler_on_off', 'off');
		}
	}
}

function setCookie (name, value, expires, path, domain, secure) {
	if (!expires)	{
		expires = 'Monday, 02-03-2015 09:00:00 GMT';
	}
	document.cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
}

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}
