

function Goto(url)
{
	if(url.length>4)
		if(url.substring(0,7).toUpperCase()!='HTTP://')
			url="Http://" + url;
	window.open(url,"_blank");
	return false;
}
function Char(ascii)
{
	return String.fromCharCode( ascii );

}
function cmdPrintMaterial(RequiresLogin)
{
	var url = Char(47) + "default.aspx?tabid=120&mid=705&dnnprintmode=true";
	if (RequiresLogin==1)
	{
		url = Char(47) + "default.aspx?tabid=273&mid=1137&dnnprintmode=true";
	}
	
	url += Char(38) + "SkinSrc=%5bG%5dSkins%2f_default%2fNo+Skin" + Char(38) + "ContainerSrc=%5bG%5dContainers%2f_default%2fNo+Container";
	
	var features="width=720, height=550, scrollbars= yes, top=50 ";
	var name="_blank";
	var oWin = window.open(url,name,features);
	if (oWin.addEventListener)
	{
		oWin.addEventListener("load", function(){clearPrint(oWin)}, false);
	}
	else
	{
		oWin.attachEvent("onload", function(){clearPrint(oWin)}, false);
	}

	
}
function clearPrint(oWin)
{
	 var oDiv = oWin.document.getElementById("styleShareInfo");
	 if (oDiv!=null) oDiv.style.display='none';
	 oDiv = oWin.document.getElementById("addToCart");
	 if (oDiv!=null) oDiv.style.display='none';
	 
	 oDiv = oWin.document.getElementById("areaMaterial");
	 if (oDiv!=null) oDiv.style.fontSize = getFontSize();
	 oWin.print();
}
function FontSize()
{
	var _unit = "pt";
	var _value = 9;
	this.setSize = function(value){
		if (value=="") return;
		var valTemp ='';
		var strVal = new String(value);
		valTemp = strVal.replace('em','');
		if (strVal.length!=valTemp.length) {_unit='em'; _value=parseFloat(valTemp); return;}
		valTemp = strVal.replace('ex','');
		if (strVal.length!=valTemp.length) {_unit='ex'; _value=parseFloat(valTemp); return;}
		valTemp = strVal.replace('px','');
		if (strVal.length!=valTemp.length) {_unit='px'; _value=parseFloat(valTemp); return;}
		valTemp = strVal.replace('%','');
		if (strVal.length!=valTemp.length) {_unit='%'; _value=parseFloat(valTemp); return;}
		valTemp = strVal.replace('in','');
		if (strVal.length!=valTemp.length) {_unit='in'; _value=parseFloat(valTemp); return;}
		valTemp = strVal.replace('cm','');
		if (strVal.length!=valTemp.length) {_unit='cm'; _value=parseFloat(valTemp); return;}
		valTemp = strVal.replace('mm','');
		if (strVal.length!=valTemp.length) {_unit='mm'; _value=parseFloat(valTemp); return;}
		valTemp = strVal.replace('pt','');
		if (strVal.length!=valTemp.length) {_unit='pt'; _value=parseFloat(valTemp); return;}
		valTemp = strVal.replace('pc','');
		if (strVal.length!=valTemp.length) {_unit='pc'; _value=parseFloat(valTemp); return;}
		_unit=''; 
		_value=parseFloat(strVal); 
		return;
	};
	this.increase=function(){
		addSize(1);
	}
	this.decrease=function(){
		addSize(-1);
	}
	function addSize(plus){
		if (_unit=='em') {if (isValid(plus+_value)){_value=plus+_value;}return;}
		if (_unit=='ex') {if (isValid(plus+_value)){_value=plus+_value;}return;}
		if (_unit=='px') {if (isValid(plus+_value)){_value=plus+_value;}return;}
		if (_unit=='%')  {if (isValid((10*plus)+_value)){_value=(10*plus)+_value;}return;}
		if (_unit=='in') {if (isValid((0.01*plus)+_value)){_value=(0.01*plus)+_value;}return;}
		if (_unit=='cm') {if (isValid((0.03*plus)+_value)){_value=(0.03*plus)+_value;}return;}
		if (_unit=='mm') {if (isValid((0.03*plus)+_value)){_value=(0.03*plus)+_value;}return;}
		if (_unit=='pt') {if (isValid(plus+_value)){_value=plus + _value;}return;}
		if (_unit=='pc') {if (isValid((0.1*plus)+_value)){_value=(0.1*plus)+_value;}return;}
		
		if (isValid(plus+_value))_value= _value+ plus;
		return;
	}
	function isValid(newValue){
		if (_unit=='em') {return true;}
		if (_unit=='ex') {return true;}
		if (_unit=='px') {if (newValue>7) if(30>newValue) return true;}
		if (_unit=='%')  {if (newValue>30) if(300>newValue) return true;}
		if (_unit=='in') {if (newValue>0.01) if(3>newValue) return true;}
		if (_unit=='cm') {if (newValue>0.10) if(10>newValue) return true;}
		if (_unit=='mm') {if (newValue>0.10) if(10>newValue) return true;}
		if (_unit=='pt') {if (newValue>4) if(20>newValue)return true;}
		if (_unit=='pc') {if (newValue>1) if(20>newValue) return true;}
		
		return false;
	}
	this.getValue= function(){return _value;};
	this.getUnit= function(){return _unit;};
	this.getSize= function(){
		return _value + _unit;
	}
}
function getFontSize()
{
	var oDiv = window.document.getElementById("areaMaterial");
	var oSizer = new FontSize();
	oSizer.setSize(oDiv.style.fontSize);
	var retTemp = oSizer.getSize();
	oSizer = null;
	return retTemp;
}
function IncreaseFontSize()
{
	var oDiv = window.document.getElementById("areaMaterial");
	var oSizer = new FontSize();
	oSizer.setSize(oDiv.style.fontSize);
	oSizer.increase();
	oDiv.style.fontSize = oSizer.getSize();
	oSizer = null;
	return false;
}
function DecreaseFontSize()
{
	var oDiv = window.document.getElementById("areaMaterial");
	var oSizer = new FontSize();
	oSizer.setSize(oDiv.style.fontSize);
	oSizer.decrease();
	oDiv.style.fontSize = oSizer.getSize();
	oSizer = null;
	return false;
}