
function pagecontrols_init(textcolor, bgcolor, linkcolor, vlinkcolor) {
	$('#textcolorSelector').ColorPicker({
		color: textcolor,
		hideOnSubmit: true,
		showCancel: true,
		onShow: function (colpkr) {
			$('#textcolorSelector').ColorPickerSetColor($('input[name=PageAttrColorText]').val());
			$(colpkr).fadeIn(500);
			return false;
		},
		onHide: function (colpkr) {
			$(colpkr).fadeOut(500);
			return false;
		},
		onSubmit: function(hsb, hex, rgb) {
			$('#textcolorSelector').css({'backgroundColor':'#' + hex,'background-image':'none'});
			$('input[name=PageAttrColorText]').val('#' + hex);
		}
	});
	$('#bgcolorSelector').ColorPicker({
		color: bgcolor,
		hideOnSubmit: true,
		showCancel: true,
		onShow: function (colpkr) {
			$('#bgcolorSelector').ColorPickerSetColor($('input[name=PageAttrColorBG]').val());
			$(colpkr).fadeIn(500);
			return false;
		},
		onHide: function (colpkr) {
			$(colpkr).fadeOut(500);
			return false;
		},
		onSubmit: function(hsb, hex, rgb) {
			$('#bgcolorSelector').css('backgroundColor', '#' + hex);
			$('input[name=PageAttrColorBG]').val('#' + hex);
		}
	});
	$('#linkcolorSelector').ColorPicker({
		color: linkcolor,
		hideOnSubmit: true,
		showCancel: true,
		onShow: function (colpkr) {
			$('#linkcolorSelector').ColorPickerSetColor($('input[name=PageAttrColorLink]').val());
			$(colpkr).fadeIn(500);
			return false;
		},
		onHide: function (colpkr) {
			$(colpkr).fadeOut(500);
			return false;
		},
		onSubmit: function(hsb, hex, rgb) {
			$('#linkcolorSelector').css('backgroundColor', '#' + hex);
			$('input[name=PageAttrColorLink]').val('#' + hex);
		}
	});
	$('#vlinkcolorSelector').ColorPicker({
		color: vlinkcolor,
		hideOnSubmit: true,
		showCancel: true,
		onShow: function (colpkr) {
			$('#vlinkcolorSelector').ColorPickerSetColor($('input[name=PageAttrColorVLink]').val());
			$(colpkr).fadeIn(500);
			return false;
		},
		onHide: function (colpkr) {
			$(colpkr).fadeOut(500);
			return false;
		},
		onSubmit: function(hsb, hex, rgb) {
			$('#vlinkcolorSelector').css('backgroundColor', '#' + hex);
			$('input[name=PageAttrColorVLink]').val('#' + hex);
		}
	});

}

function default_color(jqdiv,fid, color) {
	jqdiv.css({background:'transparent','background-color':color});
	$('input[name='+fid+']').val('');
}

function toggle_page_controls() {

	var pcr = $('#pagecontrols_row');
	var shpcb_s = $('#shpc_button_show');
	var shpcb_h = $('#shpc_button_hide');

	if (pcr.css('display') == 'none') {
		pcr.show();
		shpcb_s.hide();
		shpcb_h.show();
	} else {
		pcr.hide();
		shpcb_s.show();
		shpcb_h.hide();
	}

}



ForB = 1  //¥*s*Fâ©ÓwÎi*Fâ©*B2.02âíÄoÄOä–Óâíâ*â§*gÑp*B
function color_is_(cvalue, changePage) {
	if (changePage != 0)	changePage = 1;
	oldBgColor = document.bgColor;
	//alert(changePage);
	switch (ForB) {
		case 1:
			document.attributes.PageAttrColorText.value = cvalue;
			document.fgColor = cvalue;
			document.ColorTextSample.src = ("http://i.imaxws.net/onecolorgif.php?colorcode=" + cvalue.slice(1,7));
			break;
		case 2:
			document.attributes.PageAttrColorBG.value = cvalue;
			document.bgColor = cvalue;
			if (changePage!=1)	document.bgColor = oldBgColor;
			document.ColorBGSample.src = ("http://i.imaxws.net/onecolorgif.php?colorcode=" + cvalue.slice(1,7));
			break;
		case 3:
			document.attributes.PageAttrColorLink.value = cvalue;
			document.linkColor = cvalue;
			document.ColorLinkSample.src = ("http://i.imaxws.net/onecolorgif.php?colorcode=" + cvalue.slice(1,7));
			break;
		case 4:
			document.attributes.PageAttrColorVLink.value = cvalue;
			document.vlinkColor = cvalue;
			document.ColorVLinkSample.src = ("http://i.imaxws.net/onecolorgif.php?colorcode=" + cvalue.slice(1,7));
			break;
	}
}

function colorEntry(bVal, fldRef, refreshpage)
{
	fldRef.value = fldRef.value.toUpperCase();
	cvalue = fldRef.value;
	TempB=ForB;
	ForB=bVal;
	color_is_(cvalue, refreshpage);
	ForB=TempB;
	tempVal = document.bgColor;
	document.bgColor = cvalue;
	document.bgColor = tempVal;
}


function selectAccessTypeBtn(theValue)
{
	document.attributes.AccessIndexSelect[theValue].checked = true;
}


function deleteSectionConfirm(sectType)
{
	return confirm("Are you sure you want to delete this "+sectType+" section?");
}

