// JavaScript Document

//MAIN CONTACT

function formSubmitContact()

{

  if (formValidContact()){
	  var fname= gv('fname') + " "+ gv('lname');
  ajax.call('sendContact', gv('emailC'), fname, gv('phone'), gv('comm'));
     }
}
function emptyc(id,msg)

{

   if (gv(id) == "")

   {
      var form = e('expocont');
	  form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	   
      if(msg){
		form[id].value='Missing ' + msg;
	  }
	  
       
      
      return true;

   }

   return false;

}



function formValidContact()

{

   var form = e('expocont');
  var err = false;
   	
  if (gv('lname') == "" ||  gv('lname') == "Missing last name"){
	  id='lname';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing last name";
	  err |= true;
  }
   if (gv('fname') == "" ||  gv('fname') == "Missing first name"){
	  id='fname';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing first name";
	  err |= true;
  }
  if (gv('phone') == "" ||  gv('phone') == "Missing telephone"){
	  id='phone';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing telephone";
	  err |= true;
  }
  if (gv('emailC') == "" ||  gv('emailC') == "Missing email address"){
	  id='emailC';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing email address";
	  err |= true;
  }
   if (gv('comm') == "" ||  gv('comm') == "Missing comment/inquiry"){
	  id='comm';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing comment/inquiry";
	  err |= true;
  }
   
 if(gv('emailC') != "Missing email address"){

     if (!checkEmail(gv('emailC')))
         {
         var form = e('expocont');
	    form['emailC'].style.backgroundColor='#fd030f';
	    form['emailC'].style.color='#ffffff';
		form['emailC'].value='Email has wrong format';
		 err |= true;
	     } 
	}
	
   
   return !err;

}
function defaultStatusContact(id)

{
 var form = e('expocont');
 form[id].style.backgroundColor='#ffffff';
 form[id].style.color='#000000';
   
   

  
}




////magazine form



	

function formSubmit()

{

  if (formValid()){
	 ajax.call('sendRequest', gv('userN'), gv('userE'), gv('add1'), gv('city'), gv('state'), gv('pc'));
     }
}
function emptyc(id,msg)

{

   if (gv(id) == "")

   {
      var form = e('expocont');
	  form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	   
      if(msg){
		form[id].value='Missing ' + msg;
	  }
	  
       
      
      return true;

   }

   return false;

}



function formValid()

{

   var form = e('magre');
  var err = false;
   	
  if (gv('userN') == "" ||  gv('userN') == "Missing Name"){
	  id='userN';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing Name";
	  err |= true;
  }
   if (gv('add1') == "" ||  gv('add1') == "Missing Address"){
	  id='add1';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing Address";
	  err |= true;
  }
  if (gv('city') == "" ||  gv('city') == "Missing City"){
	  id='city';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing City";
	  err |= true;
  }
  if (gv('userE') == "" ||  gv('userE') == "Missing Email Address"){
	  id='userE';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing Email Address";
	  err |= true;
  }
   if (gv('state') == "" ||  gv('state') == "Missing State"){
	  id='state';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing State";
	  err |= true;
  }
   if (gv('pc') == "" ||  gv('pc') == "Missing!"){
	  id='pc';
      form[id].style.backgroundColor='#fd030f';
	  form[id].style.color='#ffffff';
	  form[id].value= "Missing!";
	  err |= true;
  }
   
 if(gv('userE') != "Missing Email Address"){

     if (!checkEmail(gv('userE')))
         {
          var form = e('magre');
	    form['userE'].style.backgroundColor='#fd030f';
	    form['userE'].style.color='#ffffff';
		form['userE'].value='Email has wrong format';
		 err |= true;
	     } 
	}
	
   
   return !err;

}
function defaultStatusM(id)

{
var form = e('magre');
 form[id].style.backgroundColor='#ffffff';
 form[id].style.color='#000000';
  form[id].value='';
   
   

  
}