
var PATH = "";

/**
* RENVOIE LES ELEMENT D'UN FORMULAIRE
*/

function exec_form_modif_country( country_id )
  {
	setTimeout( "hide_element('text_notification');" , 1500 );
	var values = "type_form=modif_country"
			+ "&ID=" + encodeURI( document.getElementById("ID").value )
			+ "&Name=" + encodeURI( document.getElementById("Name").value )
			+ "&Code=" + encodeURI( document.getElementById("Code").value )
			+ "&TVA=" + encodeURI( document.getElementById("TVA").value )
			+ "&ZoneID=" + encodeURI( document.getElementById("ZoneID").value )
			+ "&Known=" + encodeURI( document.getElementById("Known").selectedIndex );

	request_post( 'country.php?do=modif_country&id=' + country_id , values , 'modif_country' );
  }


/**
* VERIFICATION DU FORMULAIRE AJOUT PROMO
*/

function check_form_new_promo()
   {
	if( !check_selectbox( "ArticleID" , "-1" ) )		{ return false; }
	if( !check_input_text("Name") )				{ return false; }
	if( !check_input_text("DateBegin") )			{ return false; }
	if( !check_input_text("DateEnd") )				{ return false; }
	if( !check_input_text("Percent") )				{ return false; }

	return true;
   }


/**
* VERIFICATION DU FORMULAIRE AJOUT CATEGORIE
*/

function check_form_new_category()
   {
	if( !check_selectbox( "SiteID" , "-1" ) )			{ return false; }
	if( !check_input_text("Name") )				{ return false; }
	if( !check_input_text("Color") )				{ return false; }
	if( !check_input_text("RefTitle") )				{ return false; }
	if( !check_input_text("RefKeywords") )			{ return false; }

	return true;
   }

/**
* VERIFICATION DU FORMULAIRE AJOUT ARTICLE
*/

function check_form_new_article()
   {
	if( !check_selectbox( "SiteID" , "-1" ) )			{ return false; }
	if( !check_selectbox( "CategoryID" , "-1" ) )		{ return false; }
	if( !check_input_text("Name") )				{ return false; }
	if( !check_input_text("Width") )				{ return false; }
	if( !check_input_text("Height") )				{ return false; }
	if( !check_input_text("Print") )				{ return false; }
	if( !check_input_text("Weight") )				{ return false; }
	if( !check_input_text("Offset") )				{ return false; }
	if( !check_input_text("DeliveryDelay") )			{ return false; }
	if( !check_selectbox( "UserID" , "-1" ) )			{ return false; }

	return true;
   }

/**
* VERIFICATION DU FORMULAIRE AJOUT PACKAGE
*/

function check_form_new_package()
   {
	if( !check_input_text("NewNbItems") )			{ return false; }
	if( !check_input_text("NewPrice") )				{ return false; }

	return true;
   }

/**
* VERIFICATION DU FORMULAIRE AJOUT PACKAGE
*/


function exec_form_modif_package( article_id , package_id )
  {
	setTimeout( "hide_element('text_notification');" , 8000 );
	var values = "type_form=modif_package"
			+ "&PackageID=" + package_id 
			+ "&NbItems=" + encodeURI( document.getElementById("Modif_Package_NbItems_"+package_id).value )
			+ "&Price=" + encodeURI( document.getElementById("Modif_Package_Price_"+package_id).value )
			+ "&Status=" + encodeURI( document.getElementById("Modif_Package_Status_"+package_id).selectedIndex );

	request_post( 'articles.php?do=modif_article&id=' + article_id + "&upd=" + encodeURI( "Modification du package effectuée" ) , values , 'modif_article' );
  }

function exec_form_delete_package( article_id , package_id , msg )
  {
	if( confirm( msg ) )
	  {
		setTimeout( "hide_element('text_notification');" , 8000 );
		request( 'articles.php?do=modif_article&id=' + article_id + '&delete_package=' + package_id + "&upd=" + encodeURI( "Package " + package_id + " supprimé" ) , 'modif_article' );
	  }
  }
