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();
		w.close();
	}
}

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 ( sErrorMessage != "Följande fält är obligatoriska: \n" )
	{
		alert(sErrorMessage);
		return false;
	}
	return true;
}
function ValidateEng ( objForm )
{
	sErrorMessage = "The following fields are mandatory: \n";
	if ( objForm.Company.value == "" )
		sErrorMessage += " - Company \n";
		
	if ( objForm.Name.value == "" )
		sErrorMessage += " - Name \n";
		
	if ( objForm.Address.value == "" )
		sErrorMessage += " - Address \n";
		
	if ( objForm.Phone.value == "" )
		sErrorMessage += " - Phone daytime (work) \n";
	
	if ( objForm.Email.value == "" )
		sErrorMessage += "  - E-mail \n";
		
	if ( sErrorMessage != "The following fields are mandatory: \n" )
	{
		alert(sErrorMessage);
		return false;
	}
	return true;
}


function ValidateNki ( objForm )
{
	sErrorMessage = "Följande fält är obligatoriska: \n";
	
	if ( objForm.sName.value == "" )
		sErrorMessage += " - Namn \n";
		
	if ( objForm.sEmail.value == "" )
		sErrorMessage += " - E-post \n";
		
	if ( objForm.sCompany.value == "" )
		sErrorMessage += " - Företag \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();
}function submit_or_not( text ){  var choice = confirm(text);  if (choice == 1)    document.forms[0].submit();  else     return 0;}

function openUploadWindow( sFieldName )
{
	var UploadPopUpWindow = window.open("/asp/Upload.asp?sFieldName=" + sFieldName,"PopUpWindow","width=300,height=150,status=1,resize=1");
}

function openUploadWindowEng( sFieldName )
{
	var UploadPopUpWindow = window.open("/eng/Upload.asp?sFieldName=" + sFieldName,"PopUpWindow","width=300,height=150,status=1,resize=1");
}