function printPage ()
{
	var pr = ( window.print ) ? 1 : 0;
	
	if ( !pr )
	{
		window.status = "Print function error, please refere to browsers normal print function.";
		return;
	}
	
	var printArea = document.getElementById("TdMainField");
	if ( printArea == null )
	{
		window.status = "Print function error, please refere to browsers normal print function.";
		return;
	}
	
	if ( printArea )
	{
		var sStart	= "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"/inc/css/global.css\">";
		sStart		+= "</head><body style=\"background-color: #FFF; margin: 10px 10px 10px 10px;\"><div align=\"left\">";
		sStop		= "</div></body></html>";

		var w		= window.open('about:blank','printWin','width=650,height=600,scrollbars=yes');
		wdoc		= w.document;
		wdoc.open();
		wdoc.write( sStart + TdMainField.innerHTML + sStop ) ;
		wdoc.close();
		w.print();
	}
}

function validateContact ( objForm )
{
	sErrorMessage = "Följande fält är obligatoriska: \n";
	
	if ( objForm.Recipient.options[objForm.Recipient.selectedIndex].value == "0" )
		sErrorMessage += " - Avdelning \n";
		
	if ( objForm.Heading.value == "" )
		sErrorMessage += " - Ärende \n";
		
	if ( objForm.Message.value == "" )
		sErrorMessage += " - Meddelande \n";
		
	if ( objForm.Sender.value == "" )
		sErrorMessage += " - Avsändare \n";
		
	if ( objForm.Email.value == "" )
		sErrorMessage += " - E-post \n";
		
	if ( sErrorMessage != "Följande fält är obligatoriska: \n" )
	{
		alert(sErrorMessage);
		return false;
	}
	return true;
}

function Validate ( objForm )
{
	sErrorMessage = "Följande fält är obligatoriska: \n";
	if ( objForm.Company.value == "" )
		sErrorMessage += " - Företag \n";
		
	if ( objForm.Name.value == "" )
		sErrorMessage += " - Namn \n";
		
	if ( objForm.Address.value == "" )
		sErrorMessage += " - Adress \n";
		
	if ( objForm.Phone.value == "" )
		sErrorMessage += " - Telefon \n";
	
	if ( objForm.Email.value == "" )
		sErrorMessage += "  - E-post \n";
		
	if ( objForm.FromLanguage.options[objForm.FromLanguage.selectedIndex].value == "0" ) 
		sErrorMessage += " - Översättning från språk \n";

	if ( !IsSelected(objForm.ToLanguage) )
		sErrorMessage += " - Översättning till språk \n";
		
	if ( objForm.DeliveryTo.value == "" )
		sErrorMessage += " - Leveransdatum till Ord & Stil \n";

	if ( sErrorMessage != "Följande fält är obligatoriska: \n" )
	{
		alert(sErrorMessage);
		return false;
	}
	return true;
}

function IsSelected ( objElement )
{
	var b = false;
	for ( i = 0; i < objElement.length; i++ )
	{
		if ( objElement.options[i].selected == true )
			b = true;
	}
	return b;
}

function BackToForm ( sURL )
{
	document.forms[0].action = sURL;
	document.forms[0].submit();
}

function SendForm ()
{
	document.forms[0].submit();
}