document.domain = '34sp.com';
function checkRefreshTime() {
}


// generic js for 34sp.com site
// used to preload images in browser cache
function preload_images() {
	// give document a symbol
	var d = document;
	// array of registered images
	if (!d.IMGS && d.images) {
		d.IMGS = new Array();
	}
	
	// register images here
	var args = preload_images.arguments;
	
	// the length of the array
	var arrLength = d.IMGS.length;
	
	// iterate through each argument and load them
	for(n=0; n<args.length; n++) {
		// check the image name is ok
		if (args[n].indexOf("#")!=0) {
			// make a new image and add an image to it
			d.IMGS[arrLength] = new Image;
			d.IMGS[arrLength++].src = args[n];
		}
	}
}

// used to create rollover effect and rollout likewise
function switch_image(id, image) {
	if (id.src>'') {
		id.src = image;
	}	// its not passed as this
	// get the id
	id = document.getElementById(id);
	if (id) {
		id.src = image;
	}
}
// is going to apply various css affects
function apply_css(id, style, value) {
	// test the element exists
	var id = document.getElementById(id);
	
	if (id) {
		// detect css effect and deal
		if (style=='display') {
			// figure out what display to apply
			try {
				if (id.style.display=='table-row') {
					id.style.display = 'none'; // make it visible
				} else {
					id.style.display = 'table-row'; // make it hidden
				}
			} catch(exception) {
				if (id.className=='show_tr') {
					id.className = 'hide'; // make it visible
				} else {
					id.className = 'show_tr'; // make it hidden
				}
			}
		} else if (value>'') {
			eval("id.style."+style+" = '"+value+"';");
		}
	}
}

// this function forces prices to format 00.00
function price_format(price) {
	var regex_float_10_2 = /\.[0-9]$/;	// regex to see if last digit is missing a 0
	var regex_round_2 = /\./;	// see if it has a decimal place if not make it have one
	var no_dps = /\.$/;	// see if it has a decimal place if not make it have one
	var more_than_2dp = /\.[0-9]{3,}$/;	// see if it has a decimal place if not make it have one
	
	// check for 0. with no 00
	if (more_than_2dp.test(price)) {
		price = Math.round(price*100)/100;
	}
	
	// check first for the missing 0
	if (regex_float_10_2.test(price)) {
		return price.toString()+"0";
	}
	
	// check for no .00
	if (!regex_round_2.test(price)) {
		return price.toString()+".00";
	}
	
	// check for 0. with no 00
	if (no_dps.test(price)) {
		return price.toString()+"00";
	}
	
	// if not matched above return price
	return price;
}

