// JavaScript Document

$(document).ready(function(){
				
				$('#txtPreview').click(function(){$(".previewDiv").show();
				var adCity = $('#selCity option:selected').val();
				$.post('getPostAdVars.php', {cityId : adCity},
					   function(data)
					   { 
					   var cityName=data; 
					   $("#adCityDiv").html(cityName);
					   });
				
				var adCity2 = $('#city2 option:selected').val();
				$.post('getPostAdVars.php', {cityId : adCity2},function(data)
					{ 
						var cityName2=data; 
						if(cityName2!='')
							{
								$("#previewTxtDiv2").show();
								$("#adCityDiv2").html(cityName2);
							}
						else
							{
								$("#previewTxtDiv2").hide();
							}
					});

				
				var adCity3 = $('#city3 option:selected').val();
				$.post('getPostAdVars.php', {cityId : adCity3},function(data)
						{ 
							var cityName3=data; 
							if(cityName3!='')
								{
									$("#previewTxtDiv3").show();
									$("#adCityDiv3").html(cityName3);
								}
							else
								{
									$("#previewTxtDiv3").hide();
								}
						
						});
				
				var adCity4 = $('#city4 option:selected').val();
				$.post('getPostAdVars.php', {cityId : adCity4},function(data)
					{ 
						var cityName4=data;
						if(cityName4!='')
							{
								$("#previewTxtDiv4").show();
								$("#adCityDiv4").html(cityName4);
							}
						else
							{
								$("#previewTxtDiv4").hide();
							}
					});
				
				var adCity5 = $('#city5 option:selected').val();
				$.post('getPostAdVars.php', {cityId : adCity5},function(data)
					{ 
						var cityName5=data; 
						if(cityName5!='')
							{
								$("#previewTxtDiv5").show();
								$("#adCityDiv5").html(cityName5);
							}
						else
							{
								$("#previewTxtDiv5").hide();
							}
					});
				
				var state = $('#selState option:selected').val();
				$.post('getPostAdVars.php', {stateId : state},function(data)
					{ 
						var stateName=data; 
						
						if(stateName!='')
							{
								$("#previewTxtDiv").show();
								$("#adStateDiv").html(stateName);
							}
						else
							{
								$("#previewTxtDiv").hide();
							}
					});
				
				var adCat = $('#category option:selected').val();
				$.post('getPostAdVars.php', {catId : adCat},function(data){ var catName=data; $("#adCatDiv").html(catName);});

				var adSubCat = $('#selSubCat option:selected').val();
				$.post('getPostAdVars.php', {subCatId : adSubCat},function(data){var subCatName=data; $("#adSubCatDiv").html(subCatName);});

				var adType = $('input:radio[name=adtype]:checked').val();
				$("#adTypeDiv").html(adType);
				
				var adNoDays = $('#noofdays option:selected').val();
				$("#adNoDaysDiv").html(adNoDays);

				var adTitle = $('#adtitle').val();
				$("#adTitleDiv").html(adTitle);

				var adSubTitle = $('#adSubTitle').val();
				$("#adSubTitleDiv").html(adSubTitle);
				
				var adUrl = $('#website').val();
				
				if(adUrl!="")
				{
					$("#previewTxtDivU").show();
					$("#adUrlDiv").show();
					$("#adUrlDiv").html(adUrl);
				}
				else
				{
					$("#previewTxtDivU").hide();
					$("#adUrlDiv").hide();
				}
				
				var adRes=$('input:radio[name=res]:checked').val();
				if(adRes==4){adRes1="None";}
				if(adRes==3){adRes1="Email & Phone";}
				if(adRes==2){adRes1="Email";}
				if(adRes==1){adRes1="Phone";}				
				$('#adResDiv').html(adRes1);				
				
				var adDetail=$('#txtDetail_ifr').contents().find('#tinymce').html();
				
				$("#adDetails").html(adDetail); 
			

			});
		
		$('.hidePreview').click(function()
			{
				$(".previewDiv").hide();
			});
		
		
		$('#selSessionType1').click(function()
			{	
				var a = $('#selSessionType1').val();
				$('#newUserForm').show();
				$('#extUserForm').hide();
			});
		$('#selSessionType2').click(function()
			{	
				var a = $('#selSessionType2').val();
				$('#newUserForm').hide();
				$('#extUserForm').show();
			});	

});
