﻿function pop_file(f, w, h) {
	var temp_url = f;
	var new_win = window.open(temp_url, 'pop' + h + w, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=' + w + ',height=' + h + ',alwaysRaised=yes');
	new_win.focus();
}

function check_geu_form() {
	var form = document.signup_form;
	var el = '';
	if (form.SignupName.value == '' || form.SignupName.value == 'Your Name') el += 'Enter a value for "Your Name" \n';
	if (form.SignupEmail.value == '' || form.SignupEmail.value == 'Your Email') el += 'Enter a value for "Your Email" \n';
	if (el != '') {
		alert('Please address the following and then click "GO" again. \n \n' + el);
	} else {
		form.submit();
	}
}

function addEvent(elm, evType, fn, useCapture) {
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} else if (elm.attachEvent) {
		var r = elm.attachEvent('on' + evType, fn);
		EventCache.add(elm, evType, fn);
		return r;
	} else {
		elm['on' + evType] = fn;
	}
}

// code for scrolling announcement settings
var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline = 0;
var rotation_time = 5000; //time in milliseconds

$(document).ready(function(){
	headline_count = $("div.headline").size();
	current_headline = 0;
	var h1=$("#headline"+current_headline).height();
	var h2=$("#scrollup").height();
	h=Math.round((h2-h1)/2.3);
	$("#headline"+current_headline).show().animate({top: h},2000);
	if (headline_count>1) headline_interval = setInterval(headline_rotate,rotation_time);
	old_headline = current_headline;
});

function headline_rotate() {
	current_headline = (old_headline + 1) % headline_count
	var h2=$("#scrollup").height();
	var h1=$("#headline"+current_headline).height();
	var h3=$("#headline"+old_headline).height();
	$("#headline"+old_headline).animate({top: -h3},2000, function() {
    	$(this).css('top', h2+'px');
    });
	h=Math.round((h2-h1)/2.3);
	$("#headline"+current_headline).show().animate({top: h},2000);
	old_headline = current_headline;
}
