function styleSwitcher() 
{
	// id of the stylesheet element
	this.styleid = 'css760';
	// name of the global stylesheet
	this.smallstylesheetname = 'css/dh760.css?id=9';
	// trigger width of site - below this we use the small stylesheet
	this.triggerwidth = 984;
	// null stylesheet name - use this to prevent errors associated with a null link value
	this.nullstylesheet = 'css/dh_null.css';

	// ENTRY POINT: sets the stylesheet to the defaults (above) unless styleId and sheetname are specified
	this.setStyleSheet = function (styleId, sheetname)
	{
	//	if(!styleId)
	//		this.switchSheet(this.styleid, this.smallstylesheetname);
	//	else
	//		this.switchSheet(styleId, sheetname);
	};

	// set the specified stylesheet 
	this.switchSheet = function(styleId, sheetname)
	{
		var ssheet = $(styleId);
		var winWidth = this.getWidth();
		if (winWidth < this.triggerwidth)
			ssheet.setAttribute('href', sheetname);
		else
			ssheet.setAttribute('href', this.nullstylesheet);	
	};

	// return the width of the browser's window
	this.getWidth = function()
	{
		var ssheet;
		if (parseInt(navigator.appVersion)>3) {
			if (navigator.appName.indexOf("Microsoft")!=-1) {
				return document.body.offsetWidth;
			}
			else
			{
				return window.innerWidth;
			}
		}
	};

} // end of styleSwitcher

function catchKeyEvent(e) {
	/*
	var code;
	if (!e) 
		var e = window.event;
	if (e.keyCode) 
		code = e.keyCode;
	else if (e.which) 
		code = e.which;
	if((e.keyCode == 86 && e.ctrlKey) || (e.keyCode == 224 && e.metaKey)){
		alert("naughty!");
		e.preventDefault();
		document.getElementById('chkconfirmemail').value = "";
	}
	*/
}

// pops a new dependant window with chrome removed
function popwin(surl) {
	window.open(surl, 'newwin', 'dependent=yes,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no'); 
	return false;
}


// email checker
function isEmailFormatCorrect(strAddr) { 
	var ptn = /^[\w\d._%-]+@[\w\d._%-]+\.[\w\d._%-]{2,4}$/;
	return ptn.test(strAddr);
}

function trim(sVal) {
	while(sVal.charAt(sVal.length-1)==' ')
		sVal=sVal.substring(0,sVal.length-1);

	while(sVal.charAt(0)==' ')
		sVal=sVal.substr(1,sVal.length);

	return sVal;
}

// generic error message display
function showError(fld, msg) {
	fld.focus();
	alert(msg);
	return false;
}


function FmtCurr( szCurr ) {
	szCurr = round(szCurr);
	szCurr = szCurr.toString();
	var nPnt = szCurr.indexOf(".");
	if ( nPnt == -1 ) {
		szCurr = szCurr + ".00"; }
	else {	
		for ( var i = 1; i < 3; i++ ) {
			nPnt++ ;
			if ( nPnt > szCurr.length - 1) {
				szCurr = szCurr + "0"; }
		}
		if (nPnt < szCurr.length - 1) {
			szCurr = szCurr.slice(0, nPnt+1); }
	}
	
	x = szCurr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;

	//return szCurr;		
}

function round(num, places) {
	places = (!places ? 2 : places);
	return Math.round(num*Math.pow(10,places))/Math.pow(10,places);
}


// pops a new browser window for external websites - suppresses href by returning false
function popsite(surl) {
	window.open(surl, 'newsite', ''); 
	return false;
}

/* ************************************************************************************************
	MENU 
************************************************************************************************ */

function openmenu(cat, scat)
{

	var ul = $(('dhmnu-' + cat + '-' + scat));
	var mnu = $(('dhmnu-' + scat));

	close_all_menus(ul);

	if(mnu)
		mnu.style.backgroundColor = '#c2d5ee';

	if(ul)
	{
		if(ul.style.display == 'none')
			ul.style.display = '';					
		else
			ul.style.display = 'none';
	}
	return false;
}

function close_all_menus(selected)
{
	var selid = '';
	if(selected)
		selid = selected.id;
	var i;
	var submenus = document.getElementsByClassName('dhmnu-submenu', 'dh-left-menu');

	for(i =0; i < submenus.length; i++)
	{
		if(submenus[i].id != selid)
			submenus[i].style.display = 'none';
	}

	var menus = document.getElementsByClassName('dh-left-menu-item', 'dh-left-menu');
	for(i = 0; i < menus.length; i++)
		menus[i].style.backgroundColor = '#fff';

}

function buttonSwitcher()
{
	this.bgoff = Array();
	this.bghover = Array();
	
	this.bgoff["dh-checkout-delivery"] = 'checkout_adddeliv_butt.gif';
	this.bghover["dh-checkout-delivery"] = 'checkout_adddeliv_butt_hover.gif';

	this.bgoff["dh-checkout-delivery-back"] = 'checkout_adddeliv_butt.gif';
	this.bghover["dh-checkout-delivery-back"] = 'checkout_adddeliv_butt_hover.gif';

	this.bgoff["dh-checkout-submit"] = 'checkout_submit.gif';
	this.bghover["dh-checkout-submit"] = 'checkout_submit_grey.gif';

	this.bgoff["dh-newsletter-unsubscribe"] = 'submitbuttonlong.gif';
	this.bghover["dh-newsletter-unsubscribe"] = 'submitbuttonlonggrey.gif';

	this.bgoff["dh-newsletter-signup"] = 'submitbuttonlong.gif';
	this.bghover["dh-newsletter-signup"] = 'submitbuttonlonggrey.gif';

	this.bgoff["dh-contact-submit"] = 'submitbuttonlong.gif';
	this.bghover["dh-contact-submit"] = 'submitbuttonlonggrey.gif';

	this.bgoff["dh-address-submit"] = 'submitbutton.gif';
	this.bghover["dh-address-submit"] = 'submitbuttongrey.gif';

	this.bgoff["dh-address-billing-submit"] = 'submitbutton.gif';
	this.bghover["dh-address-billing-submit"] = 'submitbuttongrey.gif';
	
	this.bgoff["dh-register-submit"] = 'submitbuttonlong.gif';
	this.bghover["dh-register-submit"] = 'submitbuttonlonggrey.gif';
	
	this.bgoff["dh-login-submit"] = 'submitbuttonlong.gif';
	this.bghover["dh-login-submit"] = 'submitbuttonlonggrey.gif';

	this.bgoff["dh-address-submit"] = 'submitbuttonlong.gif';
	this.bghover["dh-address-submit"] = 'submitbuttonlonggrey.gif';

	this.bgoff["dh-checkout-edit"] = 'checkout_submit_grey.gif';
	this.bghover["dh-checkout-edit"] = 'checkout_submit.gif';

	this.bgoff["dh-checkout-submit-bottom"] = 'checkout_submit.gif';
	this.bghover["dh-checkout-submit-bottom"] = 'checkout_submit_grey.gif';

	this.bgoff["dh-checkout-edit-bottom"] = 'checkout_submit_grey.gif';
	this.bghover["dh-checkout-edit-bottom"] = 'checkout_submit.gif';

	this.bgoff["dh-delivery-copy"] = 'checkout_submit.gif';
	this.bghover["dh-delivery-copy"] = 'checkout_submit_grey.gif';

	this.bgoff["btn-SubmitVoucher"] = 'checkout_go.gif';
	this.bghover["btn-SubmitVoucher"] = 'checkout_go_grey.gif';

	this.bgoff["btn-suspend_top"] = 'submitbuttonlong.gif';
	this.bghover["btn-suspend_top"] = 'submitbuttonlonggrey.gif';

	this.bgoff["btn-unsuspend_top"] = 'submitbuttonlong.gif';
	this.bghover["btn-unsuspend_top"] = 'submitbuttonlonggrey.gif';

	this.bgoff["btn-save_top"] = 'submitbuttonlong.gif';
	this.bghover["btn-save_top"] = 'submitbuttonlonggrey.gif';

	this.bgoff["btn-extend_top"] = 'submitbuttonlong.gif';
	this.bghover["btn-extend_top"] = 'submitbuttonlonggrey.gif';

	this.bgoff["btn-delete_top"] = 'submitbuttonlong.gif';
	this.bghover["btn-delete_top"] = 'submitbuttonlonggrey.gif';

	this.bgoff["btn-suspend_bottom"] = 'submitbuttonlong.gif';
	this.bghover["btn-suspend_bottom"] = 'submitbuttonlonggrey.gif';

	this.bgoff["btn-unsuspend_bottom"] = 'submitbuttonlong.gif';
	this.bghover["btn-unsuspend_bottom"] = 'submitbuttonlonggrey.gif';

	this.bgoff["btn-save_bottom"] = 'submitbuttonlong.gif';
	this.bghover["btn-save_bottom"] = 'submitbuttonlonggrey.gif';

	this.bgoff["btn-extend_bottom"] = 'submitbuttonlong.gif';
	this.bghover["btn-extend_bottom"] = 'submitbuttonlonggrey.gif';

	this.bgoff["btn-delete_bottom"] = 'submitbuttonlong.gif';
	this.bghover["btn-delete_bottom"] = 'submitbuttonlonggrey.gif';
				
	this.hover = function(bgid) { $(bgid).style.backgroundImage = 'url(\'assets/' + this.bghover[bgid] + '\')'; };
	this.reset = function(bgid) { $(bgid).style.backgroundImage = 'url(\'assets/' + this.bgoff[bgid] + '\')'; };
}

/* *********************************************************************************************** */

function validateLoginForm() {
	if ($F('frm-LoginEmail') == '')	{
		return showError($('frm-LoginEmail'), 'Please enter your email address');
	}

	if ($F('frm-LoginEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-LoginEmail'))) {
			return showError($('frm-LoginEmail'), 'Please enter a valid email address');
		}
	}
	if ($F('frm-LoginPassword') == '')	{
		return showError($('frm-LoginPassword'), 'Please enter your password');
	}
	$('account-login').submit();
}

function validateCheckoutLoginForm() {
	if ($F('frm-LoginEmail') == '')	{
		return showError($('frm-LoginEmail'), 'Please enter your email address');
	}

	if ($F('frm-LoginEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-LoginEmail'))) {
			return showError($('frm-LoginEmail'), 'Please enter a valid email address');
		}
	}
	if ($F('frm-LoginPassword') == '')	{
		return showError($('frm-LoginPassword'), 'Please enter your password');
	}
	$('chk-frm').action = 'checkout.asp?a=login'
	$('chk-frm').submit();
}

function validatePasswordReminderForm() {
	if ($F('frm-LoginEmail') == '')	{
		return showError($('frm-LoginEmail'), 'Please enter your email address');
	}

	if ($F('frm-LoginEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-LoginEmail'))) {
			return showError($('frm-LoginEmail'), 'Please enter a valid email address');
		}
	}
}

function validateLookupForm() {
	if ($F('frm-AddressLookupName') == '')	{
		return showError($('frm-AddressLookupName'), 'Please enter your property name/number');
	}
	if ($F('frm-AddressLookupPostCode') == '')	{
		return showError($('frm-AddressLookupPostCode'), 'Please enter your post code');
	}
}

function validateLookupCheckoutDeliveryForm() {
	if ($F('frm-AddressLookupDeliveryName') == '')	{
		return showError($('frm-AddressLookupDeliveryName'), 'Please enter your property name/number');
	}
	if ($F('frm-AddressLookupDeliveryPostCode') == '')	{
		return showError($('frm-AddressLookupDeliveryPostCode'), 'Please enter your post code');
	}
	$('chk-frm').action = 'checkout.asp?a=lookupDel'
	$('chk-frm').submit();
}

function validateLookupCheckoutBillingForm() {
	if ($F('frm-AddressLookupName') == '')	{
		return showError($('frm-AddressLookupName'), 'Please enter your property name/number');
	}
	if ($F('frm-AddressLookupPostCode') == '')	{
		return showError($('frm-AddressLookupPostCode'), 'Please enter your post code');
	}
	$('chk-frm').action = 'checkout.asp?a=lookupBill'
	$('chk-frm').submit();
}

function validateAddAddressForm() {
	if ($F('frm-AddressName') == '')	{
		return showError($('frm-AddressName'), 'Please enter the delivery persons name');
	}
	if ($F('frm-Address1') == '')	{
		return showError($('frm-Address1'), 'Please enter your address');
	}
	if ($F('frm-AddressTown') == '')	{
		return showError($('frm-AddressTown'), 'Please enter your town');
	}
	if ($F('frm-AddressCounty') == '')	{
		return showError($('frm-AddressCounty'), 'Please enter your county');
	}
	if ($F('frm-AddressPostCode') == '')	{
		return showError($('frm-AddressPostCode'), 'Please enter your post code');
	}
}

function validatePersonalDetailsForm() {
	if ($F('frm-ContFName') == '')	{
		return showError($('frm-ContFName'), 'Please enter your first name');
	}
	if ($F('frm-ContLName') == '')	{
		return showError($('frm-ContLName'), 'Please enter your last name');
	}
	if ($F('frm-ContTelephone') == '')	{
		return showError($('frm-ContTelephone'), 'Please enter your telephone number');
	}
	if ($F('frm-ContEmail') == '')	{
		return showError($('frm-ContEmail'), 'Please enter your email address');
	}
	if ($F('frm-ContEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-ContEmail'))) {
			return showError($('frm-ContEmail'), 'Please enter a valid email address');
		}
	}
	if ($F('frm-ContAddress1') == '')	{
		return showError($('frm-ContAddress1'), 'Please enter your address');
	}
	if ($F('frm-ContAddressTown') == '')	{
		return showError($('frm-ContAddressTown'), 'Please enter your town');
	}
	if ($F('frm-ContAddressCounty') == '')	{
		return showError($('frm-ContAddressCounty'), 'Please enter your county');
	}
	if ($F('frm-ContAddressPostCode') == '')	{
		return showError($('frm-ContAddressPostCode'), 'Please enter your post code');
	}
}

function validatePasswordForm() {
	if ($F('frm-CurrentPassword') == '')	{
		return showError($('frm-CurrentPassword'), 'Please enter your current password');
	}
	if ($F('frm-Password') == '')	{
		return showError($('frm-Password'), 'Please enter your new password');
	}
	if ($F('frm-ConfirmPassword') == '')	{
		return showError($('frm-ConfirmPassword'), 'Please enter your password again to confirm');
	}
	if ($F('frm-Password').length < 6)	{
		return showError($('frm-Password'), 'Your password must be at least 6 characters');
	}
	if ($F('frm-Password') != $F('frm-ConfirmPassword'))	{
		return showError($('frm-ConfirmPassword'), 'Your passwords do not match, please enter them again');
	}
	if ($F('frm-PasswordReminder') == '')	{
		return showError($('frm-PasswordReminder'), 'Please enter your password reminder');
	}
}

function validateDownloadForm() {
	if ($F('frm-ContTitle') == '')	{
		return showError($('frm-ContTitle'), 'Please enter your title');
	}
	if ($F('frm-ContFName') == '')	{
		return showError($('frm-ContFName'), 'Please enter your first name');
	}
	if ($F('frm-ContLName') == '')	{
		return showError($('frm-ContLName'), 'Please enter your last name');
	}
	if ($F('frm-ContEmail') == '')	{
		return showError($('frm-ContEmail'), 'Please enter your email address');
	}
	if ($F('frm-ContEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-ContEmail'))) {
			return showError($('frm-ContEmail'), 'Please enter a valid email address');
		}
	}
}

function validateTAFForm() {
	if ($F('frm-ContYourName') == '')	{
		return showError($('frm-ContYourName'), 'Please enter your name');
	}
	if ($F('frm-ContFriendName') == '')	{
		return showError($('frm-ContFriendName'), 'Please enter your friends name');
	}
	if ($F('frm-ContFriendEmail') == '')	{
		return showError($('frm-ContFriendEmail'), 'Please enter your email address');
	}
	if ($F('frm-ContFriendEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-ContFriendEmail'))) {
			return showError($('frm-ContFriendEmail'), 'Please enter a valid email address');
		}
	}
	if ($F('frm-ContMessage') == '')	{
		return showError($('frm-ContMessage'), 'Please enter your message');
	}
}

function validateCatalogueForm() {
	if ($F('frm-ContTitle') == '')	{
		return showError($('frm-ContTitle'), 'Please enter your title');
	}
	if ($F('frm-ContFName') == '')	{
		return showError($('frm-ContFName'), 'Please enter your first name');
	}
	if ($F('frm-ContLName') == '')	{
		return showError($('frm-ContLName'), 'Please enter your last name');
	}
	if ($F('frm-ContEmail') == '')	{
		return showError($('frm-ContEmail'), 'Please enter your email address');
	}
	if ($F('frm-ContEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-ContEmail'))) {
			return showError($('frm-ContEmail'), 'Please enter a valid email address');
		}
	}
	if ($F('frm-ContAddress1') == '')	{
		return showError($('frm-ContAddress1'), 'Please enter your address');
	}
	if ($F('frm-ContAddressTown') == '')	{
		return showError($('frm-ContAddressTown'), 'Please enter your town');
	}
	if ($F('frm-ContAddressCounty') == '')	{
		return showError($('frm-ContAddressCounty'), 'Please enter your county');
	}
	if ($F('frm-ContAddressPostCode') == '')	{
		return showError($('frm-ContAddressPostCode'), 'Please enter your postal code');
	}
	if ($F('frm-ContTerms') != 'y')	{
		return showError($('frm-ContTerms'), 'Please tick to accept our terms & conditions');
	}
}

function validateRegisterForm() {
	if ($F('frm-ContTitle') == '')	{
		return showError($('frm-ContTitle'), 'Please enter your title');
	}
	if ($F('frm-ContFName') == '')	{
		return showError($('frm-ContFName'), 'Please enter your first name');
	}
	if ($F('frm-ContLName') == '')	{
		return showError($('frm-ContLName'), 'Please enter your last name');
	}
	if ($F('frm-ContEmail') == '')	{
		return showError($('frm-ContEmail'), 'Please enter your email address');
	}
	if ($F('frm-ContEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-ContEmail'))) {
			return showError($('frm-ContEmail'), 'Please enter a valid email address');
		}
	}
	if ($F('frm-ContAddress1') == '')	{
		return showError($('frm-ContAddress1'), 'Please enter your address');
	}
	if ($F('frm-ContAddressTown') == '')	{
		return showError($('frm-ContAddressTown'), 'Please enter your town');
	}
	if ($F('frm-ContAddressCounty') == '')	{
		return showError($('frm-ContAddressCounty'), 'Please enter your county');
	}
	if ($F('frm-ContAddressPostCode') == '')	{
		return showError($('frm-ContAddressPostCode'), 'Please enter your postal code');
	}

	if ($F('frm-ContPassword') == '')	{
		return showError($('frm-ContPassword'), 'Please enter your password');
	}
	if ($F('frm-ContConfirmPassword') == '')	{
		return showError($('frm-ContConfirmPassword'), 'Please enter your password again to confirm');
	}
	if ($F('frm-ContPassword').length < 6)	{
		return showError($('frm-ContPassword'), 'Your password must be at least 6 characters');
	}
	if ($F('frm-ContPassword') != $F('frm-ContConfirmPassword'))	{
		return showError($('frm-ContConfirmPassword'), 'Your passwords do not match, please enter them again');
	}
	if ($F('frm-ContPasswordReminder') == '')	{
		return showError($('frm-ContPasswordReminder'), 'Please enter your password reminder');
	}
	if ($F('frm-ContHearAboutUs') == '')	{
		return showError($('frm-ContHearAboutUs'), 'Please select where you heard about us');
	}
	if ($F('frm-ContAreYou') == '')	{
		return showError($('frm-ContAreYou'), 'Please select an option');
	}
	if ($F('frm-ContHowManyHorses') == '')	{
		return showError($('frm-ContHowManyHorses'), 'Please select how many horses you have');
	}
	if ($F('frm-ContWhereKeepHorses') == '')	{
		return showError($('frm-ContWhereKeepHorses'), 'Please select where you keep your horses');
	}

	if ($F('frm-ContTerms') != 'y')	{
		return showError($('frm-ContTerms'), 'Please tick to accept our terms & conditions');
	}
}

function validateContactForm() {
	if ($F('frm-ContFName') == '')	{
		return showError($('frm-ContFName'), 'Please enter your first name');
	}
	if ($F('frm-ContLName') == '')	{
		return showError($('frm-ContLName'), 'Please enter your last name');
	}
	if ($F('frm-ContEmail') == '')	{
		return showError($('frm-ContEmail'), 'Please enter your email address');
	}
	if ($F('frm-ContEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-ContEmail'))) {
			return showError($('frm-ContEmail'), 'Please enter a valid email address');
		}
	}
	if ($F('frm-ContMessage') == '')	{
		return showError($('frm-ContMessage'), 'Please enter your message');
	}
}

function validateSubscribeNewsletterForm() {
	if ($F('frm-ContTitle') == '')	{
		return showError($('frm-ContTitle'), 'Please enter your title');
	}	
	if ($F('frm-ContFName') == '')	{
		return showError($('frm-ContFName'), 'Please enter your first name');
	}
	if ($F('frm-ContLName') == '')	{
		return showError($('frm-ContLName'), 'Please enter your last name');
	}
	if ($F('frm-ContEmail') == '')	{
		return showError($('frm-ContEmail'), 'Please enter your email address');
	}
	if ($F('frm-ContEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-ContEmail'))) {
			return showError($('frm-ContEmail'), 'Please enter a valid email address');
		}
	}
}

function validateUnSubscribeNewsletterForm() {
	if ($F('frm-ContFName') == '')	{
		return showError($('frm-ContFName'), 'Please enter your first name');
	}
	if ($F('frm-ContLName') == '')	{
		return showError($('frm-ContLName'), 'Please enter your last name');
	}
	if ($F('frm-ContEmail') == '')	{
		return showError($('frm-ContEmail'), 'Please enter your email address');
	}
	if ($F('frm-ContEmail') != '') {
		if (!isEmailFormatCorrect($F('frm-ContEmail'))) {
			return showError($('frm-ContEmail'), 'Please enter a valid email address');
		}
	}
}

function validateVoucherForm() {
	//do not prevent blank entries... user might want to clear the voucher
	//if ($F('voucher-code') == '')	{
	//	return showError($('voucher-code'), 'Please enter an e-voucher/promotional code');
	//}
	return true;
}

function editAddress() {
	$('frm-EditAddress').submit();
}

function backToCheckout() {
	window.location = 'checkout.asp';
}

function goRegister() {
	window.location = 'register.asp';
}

function reset_search_form(src)
{
	switch(src)
	{
		case 'p':
			//$('srch-catno').value = $('srch-catno').title;
			$('srch-phrase').value == $('srch-phrase').title ? $('srch-phrase').value = '' : null;
			break;
		case 'c':
			//$('srch-phrase').value = $('srch-phrase').title;
			$('srch-catno').value == $('srch-catno').title ? $('srch-catno').value = '' : null;
			break;
		case 'b':
			$('srch-phrase').value = $('srch-phrase').title;
			$('srch-catno').value = $('srch-catno').title;
			break;
	}
}

function submit_search(isbutton)
{
	var sPhrase = trim($('srch-phrase').value);
	var sCatNo	= trim($('srch-catno').value);
	var sBrand	= $('srch-brand').options[$('srch-brand').options.selectedIndex].value;

	if((sPhrase == '' || sPhrase == 'word or phrase') && (sCatNo == '' || sCatNo == 'catalogue number') && sBrand == '0')
	{
		alert('Please enter something to search for');
		if(isbutton)
			return false;
	}
	else
	{
		$('dh-search-form').submit();
	}
}

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getRadioCheckedID(formID, radioObjName) {
  var radioObj = document.forms[formID].elements[radioObjName];
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.id;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].id;
		}
	}
	return "";
}

var switcher	= new styleSwitcher();
var btnswitcher = new buttonSwitcher();
// window.onresize = function() { switcher.setStyleSheet() };