/*
+----------------------------------------------------------------------+
| Assorted JavaScript functions                                        |
+----------------------------------------------------------------------+
| Copyright (c) hatchbit interactive 2002.                             |
| This functions are licensed under BSD style license.                 |
+----------------------------------------------------------------------+
| Web site: http://www.hatchbit.com                                    |
| E-mail:   info@hatchbit.com                                          |
+----------------------------------------------------------------------+
| Author: Mitja Pagon <mitja@hatchbit.com>                             |
+----------------------------------------------------------------------+
*/

function getElement(ref) {
	var IE4 = (document.all && !document.getElementById) ? true : false;
	var NS4 = (document.layers) ? true : false;
	var IE5 = (document.all && document.getElementById) ? true : false;
	var N6 = (document.getElementById && !document.all) ? true : false;
		
	if(IE5 || N6) {
		return document.getElementById(ref);
	}//end if
	if(NS4) {
		return document.layers(ref);
	}//end if
	if(IE4) {
		return document.all(ref);
	}//end if
}//end function

function verify_mail(email) {
	var result = false;
	var str = new String(email);
	var atIndex = str.indexOf("@");

	if(atIndex > 0) {
		var dotIndex = str.indexOf(".", atIndex);
		if((dotIndex > atIndex + 1) && (str.length > atIndex + 1)) {
			result = true;
		} else {
			result = false;
		}//end if
	}//end if
	return result;
}//end function

function validate_text(text_str) {
	var re = new RegExp(/\w/);
	return re.test(text_str);
}//end functions

function confirm_action(text) {
	return confirm(text);
}//end function

function navigate_to(location) {
	window.location.href = location;
}//end function

function conf_2_nav(text, location) {
	var conf = confirm_action(text);

	if(conf) {
		navigate_to(location);
		return true;
	} else {
		return false;
	}//end if
}//end function

function chgClass(tagID) {
	var tag = getElement(tagID);
	
	if(tag.className == 'nav-button') {
		tag.className = 'nav-button-over';
	} else {
		tag.className = 'nav-button';
	} //end if    
}//end function

function validate_form(formID) {
  var oForm = getElement(formID);
	
	for(var t = 0; t < oForm.anwser.length; t++) {
    if(oForm.anwser.item(t).checked) return true;
  }//next
	
  alert('Izbrati morate eno od možnosti!');
  return false;
}//end function

function matrixFlyer(sURL, sName, sFeatures) {
	open('/matrix/flyer.php', 'flyer', 'directories=no, height=350, width=352, menubar=no, location=no, resizable=no, toolbar=no, status=no, scrollbars=yes');
}//end function

function showHelp(sURL) {
	open(sURL, 'dvojkaHelp', 'directories=no, width=646, menubar=no, location=no, resizable=no, toolbar=no, status=no, scrollbars=yes');
}//end function