
function isEmptyInput(wert,empty){
	if(wert == null || wert == 'undefined' || wert == '')
		empty = true;
		
	return empty;
	
}


function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}


function checkInput(){
		var empty = false;
 		empty = isEmptyInput(trim($F('CUSTOMER_FIRSTNAME')),false);		   	
	    empty = isEmptyInput(trim($F('CUSTOMER_NAME')),empty);		   	
	    empty = isEmptyInput(trim($F('CUSTOMER_COMPANY')),empty);		   	
	    empty = isEmptyInput(trim($F('CUSTOMER_STREET')),empty);		   	
	    empty = isEmptyInput(trim($F('CUSTOMER_ZIPCODE')),empty);		   	
	    empty = isEmptyInput(trim($F('CUSTOMER_CITY')),empty);		   	
	    //empty = isEmptyInput($F('CUSTOMER_COUNTRY'),empty);		   	
	    empty = isEmptyInput(trim($F('CUSTOMER_PHONE')),empty);		   	
	    empty = isEmptyInput(trim($F('CUSTOMER_EMAIL')),empty);
	    
	    
	    
	    return empty;

}


function isCountryAllowed(country){
	
		unavailable = new Array("za");
		
		for(i=0; i < unavailable.length; i++)
			if(country == unavailable[i])
				return false;
	
	
		return true;
		
}


function printPage() {
		
	jQuery.alerts.dialogClass = 'jquerydialog'; // set custom style class
	jQuery.alerts.overlayOpacity=  0.70;               // transparency level of overlay
	jQuery.alerts.overlayColor = '#000';               // base color of overlay
	jQuery.alerts.okButton = 'Yes'; // set custom style class
	jQuery.alerts.cancelButton = 'No'; // set custom style class
	
		
	if (window.print) {
		
		jConfirm('Do you want to print this page?', 'Print page.', function(r) {
				if(r){
					window.print();
								
				}
		});
				
				
	}else{
				
		
		jAlert('Sorry, your browser does not support automatically printing. Please print manually from menue.', 'Print page.', function(r) {
				if(r){
													
				}
		});
		
		
		
	}
}

