function pop_window(url, w, h) {
	myfocus = window.open(url, 'mywindow', 'menubar=no,scrollbars=yes,width='+w+',height='+(h+30)); 
	setTimeout('myfocus.focus()',500);
}

function pop_winter_promo() {
	pop_window('/promo_winter.php', 550, 500);
}

function getObject(objectId) {
	if (document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId);
	} else if (document.all && document.all(objectId)) {
		return document.all(objectId);
	} else {
		return false;
	}
}

function hide_it(id) {
	var myObj = getObject(id);
	if (myObj.style != false) myObj.style.display = 'none';
}

function show_it(id) {
	var myObj = getObject(id);
	if (myObj.style != false) myObj.style.display = 'block';
}

function populate_it(myField, myValue, myArrayName) {
	var selectedArray = eval(myArrayName + myValue);
	while (selectedArray.length < myField.options.length) {
		myField.options[(myField.options.length - 1)] = null;
	}
	for (var i=0; i < selectedArray.length; i++) {
		eval("myField.options[i]=" + "new Option" + selectedArray[i]);
	}
}

function select_it(myField, myValue) {
	var elmLength = myField.length;
	for (var i = 0; i < elmLength; i++) {
		if (myField.options[i].value == myValue) {
			myField.selectedIndex = i
		}
	}
}

function bookmark_page() {
	title = document.title;
	url = location.href;
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if ( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title);
	} else if(window.opera && window.print) { // Opera Hotlist
		alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
	}
}

function email_page(url) {
	pop_window('/email_to_friend.php?url=' + url, 400, 280);
}

function slide_show(index, delay, counter) {
	var slideShowSpeed = delay * 1000; // slideShow speed
	var crossFadeDuration = delay; // duration of crossfade
	var t;
	var imageName = 'myPromo' + index;
	//alert(imageName);
	var container = document.getElementById(imageName);
	if (counter == null) counter = 0;
	var imageArrayName = 'imageArray' + index;
	//alert('var imageArray = ' + imageArrayName + ';');
	eval('var imageArray = ' + imageArrayName + ';');
	var arrLength = imageArray.length;
	var preLoad = new Array();
	for (i = 0; i < arrLength; i++) {
		preLoad[i] = new Image();
		preLoad[i].src = imageArray[i][0];
	}
	if (imageArray[counter][1] != '') {
		var target = '';
		if (imageArray[counter][2] > 0) target = ' target="_blank"';
		container.innerHTML = '<a href="' + imageArray[counter][1] + '"' + target + '><img src="' + preLoad[counter].src + '" border="0" id="sub' + imageName +  '" alt="" /></a>';
	} else {
		container.innerHTML = '<img src="' + preLoad[counter].src + '" border="0" id="sub' + imageName + '" alt="" />';
	}
	var subImage = document.getElementById('sub' + imageName);
	if (document.all) {
		subImage.style.filter="blendTrans(duration=2)";
		subImage.style.filter="blendTrans(duration=crossFadeDuration)";
		subImage.filters.blendTrans.Apply();
	}
	if (document.all) {
		subImage.filters.blendTrans.Play();
	}
	counter = counter + 1;
	if (counter >= (arrLength)) counter = 0;
	if (arrLength > 1) t = setTimeout('slide_show('+index+', '+delay+', '+counter+')', slideShowSpeed);
}

function womOn() {
	window.onload = womGo;
}
function womGo() {
	for (var i = 0;i < woms.length;i++) {
		//alert(woms[i]);
		eval(woms[i]);
	}
}
function womAdd(func) {
	woms[woms.length] = func;
}
var woms = new Array();

function modify_forms() {
	$('form').submit( function () {
		var extraHtml = '<input type="hidden" name="code" value="secret" />';
		$(this).append(extraHtml);
	});
}

$(document).ready(function () {
	modify_forms();
});