$(document).ready(function()
 {
 	$("#listingForm input[@type$='checkbox']").click(function()
 	 {
 	 	addVehicleToMagazine(this);
 	 }
 	)
 }
)
 
 function addVehicleToMagazine(id)
 {
    var checkedFieldName = id.name;
    var findSID = checkedFieldName.indexOf("_");
    var firstPosition = findSID + 1;
    var madAdLength = checkedFieldName.length;
    var getSID = checkedFieldName.substring(firstPosition,madAdLength);
    var theData = 0;

    
    if ($("#"+checkedFieldName).is(":checked"))
    {
    	theData = 1;
    }
    
    $.ajax(
       {
       	type:"POST", 
	    url: "../add_to_magazine", 
	    data: {"sid": getSID,"addMagazine": theData},
	    dataType: "text",
        success: function(r) {
         if ($("#"+checkedFieldName).is(":checked"))
         {
         	$("#magazineTxt_"+getSID).html("Remove From Magazine");
         }
         else
         {
         	$("#magazineTxt_"+getSID).html("Select For Magazine Ad");
         }
       }
       });
 } 

function passvalue(){ 
document.theform.SellerComments.value= document.theform.SellerComments.value + document.theform.from[document.theform.from.selectedIndex].value + ", "; 


} 

   function populateValues()
   {
   	 var expDate = $('#CC_ExpDate_Month').val() + "/" + $('#CC_ExpDate_Year').val();
	 var processForm = true;
	 
	 $('#x_exp_date').val(expDate);
	  
	 $("input[@class='isRequired']").each(function(i)
	 {
		if ($(this).val() == "")
		{
			$('#required_'+  $(this).get(0).name).html("Required").css('color','#FF0000');
			processForm = false;
		}
		else
		{
			$('#required_'+  $(this).get(0).name).html("").css('color','#FF0000');
		}
	 });
	     return processForm;
   }
