<?php echo $header;?>
<div id="dashboard">
	<div class="container">
<div class="row"><br/></div>
<div class="panel">

	<div class="panel-header">
		<?php if ( empty ( $ad ) ) { ?>
			<?php echo $LANG["WBS_PUB_AD_NEW"];?>
		<?php } else { ?>
			<?php echo $LANG["WBS_PUB_AD_UPDATE"];?>
		<?php } ?>
	</div>

<div class="panel-content">
<div class="col-md-12">
<div class="row"><br/></div>








<div class="generated-code-div" id="inline" style="display:none;"></div>





<div class="col-md-12 input-group margin-bottom-10">

<input id="pub-ad-id" type="text" class="form-control" value="<?php echo $ad['0']['pau_id'];?>" style="display:none;">

	<label><?php echo $LANG["WBS_PUB_AD_SELECT_CHANNEL"];?>  ( <a href="<?php echo HTTP_SERVER_WEBSITE;?>dashboard/publisher/channel"><?php echo $LANG["WBS_PUB_AD_CREATE_NEW_CHANNEL"];?></a> )</label>
	<select id="pub-ad-channel" class="form-control">
		<option value="0"><?php echo $LANG["WBS_PUB_AD_SELECT_CHANEL_OPTION"];?></option>
			<?php if ( !empty ( $channels ) ) { ?>
			<?php foreach($channels as $channel): ?>
				<option value="<?php echo $channel['pc_id'];?>" <?php if ( $ad['0']['pau_channel_id'] == $channel['pc_id'] ) { ?>selected<?php }?>><?php echo $channel['pc_title'];?></option>
			<?php endforeach; ?>
			<?php } ?>
	</select>
</div>



	<div class="col-md-12 input-group margin-bottom-10">
		<label><?php echo $LANG["WBS_PUB_AD_TITLE"];?></label>
		<input id="pub-ad-title" type="text" class="form-control disabled-form" placeholder="<?php echo $LANG["WBS_PUB_AD_TITLE_PLACEHOLDER"];?>" value="<?php echo $ad['0']['pau_name'];?>">
	</div>




<?php if ( empty ( $ad ) ) { ?>

<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_PUB_AD_SELECT_BANNER_SIZE"];?></label>
	<select id="pub-ad-size" class="form-control disabled-form">
		<option value="0"><?php echo $LANG["WBS_PUB_AD_SELECT_BANNER_SIZE_OPTION"];?></option>
<?php if ( !empty ( $sizes ) ) { ?>
	<?php foreach($sizes as $size): ?>
		<option data-width="<?php echo $size['pas_width'];?>" data-height="<?php echo $size['pas_height'];?>" value="<?php echo $size['pas_id'];?>" <?php if ( $ad['0']['pau_size'] == $size['pas_id'] ) { ?>selected<?php }?>><?php echo $LANG[$size['pas_name']];?></option>
	<?php endforeach; ?>

			<?php } ?>
	</select>
</div>


<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_PUB_AD_SELECT_BANNER_SIZE_TYPE"];?></label>
	<select id="pub-ad-type" class="form-control disabled-form">
		<option value="0"><?php echo $LANG["WBS_PUB_AD_SELECT_BANNER_SIZE_OPTION_TYPE"];?></option>

<option value="1" <?php if ( $ad['0']['pau_size_type'] == 1 ) { ?>selected<?php }?>><?php echo $LANG["WBS_PUB_AD_BANNER_TYPE_TEXT_BANNER"];?></option>
<option value="2" <?php if ( $ad['0']['pau_size_type'] == 2 ) { ?>selected<?php }?>><?php echo $LANG["WBS_PUB_AD_BANNER_TYPE_TEXT"];?></option>
<option value="3" <?php if ( $ad['0']['pau_size_type'] == 3 ) { ?>selected<?php }?>><?php echo $LANG["WBS_PUB_AD_BANNER_TYPE_BANNER"];?></option>

	</select>
</div>



<?php } else { ?>

<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_PUB_AD_SELECT_BANNER_SIZE"];?></label>
	<select id="pub-ad-size" class="form-control" disabled>
		<option value="0"><?php echo $LANG["WBS_PUB_AD_SELECT_BANNER_SIZE_OPTION"];?></option>
<?php if ( !empty ( $sizes ) ) { ?>
	<?php foreach($sizes as $size): ?>
		<option data-width="<?php echo $size['pas_width'];?>" data-height="<?php echo $size['pas_height'];?>" value="<?php echo $size['pas_id'];?>" <?php if ( $ad['0']['pau_size'] == $size['pas_id'] ) { ?>selected<?php }?>><?php echo $LANG[$size['pas_name']];?></option>
	<?php endforeach; ?>


			<?php } ?>
	</select>
</div>


<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_PUB_AD_SELECT_BANNER_SIZE_TYPE"];?></label>
	<select id="pub-ad-type" class="form-control" disabled>
		<option value="0"><?php echo $LANG["WBS_PUB_AD_SELECT_BANNER_SIZE_OPTION_TYPE"];?></option>

<option value="1" <?php if ( $ad['0']['pau_size_type'] == 1 ) { ?>selected<?php }?>><?php echo $LANG["WBS_PUB_AD_BANNER_TYPE_TEXT_BANNER"];?></option>
<option value="2" <?php if ( $ad['0']['pau_size_type'] == 2 ) { ?>selected<?php }?>><?php echo $LANG["WBS_PUB_AD_BANNER_TYPE_TEXT"];?></option>
<option value="3" <?php if ( $ad['0']['pau_size_type'] == 3 ) { ?>selected<?php }?>><?php echo $LANG["WBS_PUB_AD_BANNER_TYPE_BANNER"];?></option>

	</select>
</div>



<?php } ?>

<div class="row">

<div class="col-md-6">
	<div class="col-md-12 input-group margin-bottom-10">
		<legend><?php echo $LANG["WBS_PUB_AD_DESIGN_YOUR_AD"];?></legend>
	</div>




	<div class="col-md-12 input-group margin-bottom-10">
		<label><?php echo $LANG["WBS_PUB_AD_TITLE_COLOR"];?></label>
		<input id="title-color" type="text" class="form-control color-picker disabled-form" placeholder="" value="<?php if ( empty ( $ad['0']['paud_title'] ) ) { ?>#0000ff<?php } else { ?><?php echo $ad['0']['paud_title'];?><? } ?>">
	</div>

	<div class="col-md-12 input-group margin-bottom-10">
		<label><?php echo $LANG["WBS_PUB_AD_LINK_COLOR"];?></label>
		<input id="link-color" type="text" class="form-control color-picker disabled-form" placeholder="" value="<?php if ( empty ( $ad['0']['paud_link'] ) ) { ?>#0e8f0e<?php } else { ?><?php echo $ad['0']['paud_link'];?><? } ?>">
	</div>

	<div class="col-md-12 input-group margin-bottom-10">
		<label><?php echo $LANG["WBS_PUB_AD_TEXT_COLOR"];?></label>
		<input id="text-color" type="text" class="form-control color-picker disabled-form" placeholder="" value="<?php if ( empty ( $ad['0']['paud_text'] ) ) { ?>#333<?php } else { ?><?php echo $ad['0']['paud_text'];?><? } ?>">
	</div>

	<div class="col-md-12 input-group margin-bottom-10">
		<label><?php echo $LANG["WBS_PUB_AD_BACKGROUND_COLOR"];?></label>
		<input id="background-color" type="text" class="form-control color-picker disabled-form" placeholder="" value="<?php if ( empty ( $ad['0']['paud_background'] ) ) { ?>#fff<?php } else { ?><?php echo $ad['0']['paud_background'];?><? } ?>">
	</div>

	<div class="col-md-12 input-group margin-bottom-10">
		<label><?php echo $LANG["WBS_PUB_AD_BORDER_COLOR"];?></label>
		<input id="border-color" type="text" class="form-control color-picker disabled-form" placeholder="" value="<?php if ( empty ( $ad['0']['paud_border'] ) ) { ?>#c7c7c7<?php } else { ?><?php echo $ad['0']['paud_border'];?><? } ?>">
	</div>


<div class="col-md-12 input-group margin-bottom-10">
	<div id="ad-pub-loader"></div>
</div>


<div class="col-md-12 input-group margin-bottom-10">

<?php if ( !empty ( $ad ) ) { ?>
	<button id="ad-pub-get-code" type="submit" class="btn blue-btn pull-right disabled-form"><?php echo $LANG["WBS_PUB_AD_UPDATE_GET_CODE"];?></button>
	<div class="pull-right">&nbsp;&nbsp;</div>
<?php } ?>

	<button id="ad-pub-submit" type="submit" class="btn blue-btn pull-right disabled-form"><?php echo $LANG["WBS_PUB_AD_SUBMIT"];?></button>
	<a class="other_solution" href="#inline" style="display:none;"></a>
</div>

</div>




<div class="col-md-6">

<div id="ad-design-div" style="display:none;">
	<div id="title-color-preview"><?php echo $LANG["WBS_PUB_AD_PREVIEW_TITLE"];?></div>
	<div id="link-color-preview"><?php echo HTTP_DOMAIN;?></div>
	<div id="text-color-preview"><?php echo $LANG["WBS_PUB_AD_PREVIEW_FULL_LINE"];?></div>
	<div class="row"></div>
	<div id="button-color-preview">&gt;</div>
</div>

</div>




</div>







<div class="row"><br/></div>
</div>
<div class="row"><br/></div>
</div>

</div>
</div>
</div>




<script>


jQuery(document).ready(function (e) {

<?php if ( empty ( $ad ) ) { ?>
	$(".disabled-form").attr("disabled", "disabled");
<?php } else { ?>
	$(".disabled-form").removeAttr('disabled');
<?php } ?>




<?php if ( !empty ( $ad['0']['paud_title'] ) ) { ?>
	$( "#title-color-preview" ).css( "color", "<?php echo $ad['0']['paud_title'];?>" );
<?php } ?>

<?php if ( !empty ( $ad['0']['paud_link'] ) ) { ?>
	$( "#link-color-preview" ).css( "color", "<?php echo $ad['0']['paud_link'];?>" );
	$( "#button-color-preview" ).css( "background", "<?php echo $ad['0']['paud_link'];?>" );
<?php } ?>

<?php if ( !empty ( $ad['0']['paud_text'] ) ) { ?>
	$( "#text-color-preview" ).css( "color", "<?php echo $ad['0']['paud_text'];?>" );
<?php } ?>

<?php if ( !empty ( $ad['0']['paud_background'] ) ) { ?>
	$( "#ad-design-div" ).css( "background", "<?php echo $ad['0']['paud_background'];?>" );
	$( "#button-color-preview" ).css( "color", "<?php echo $ad['0']['paud_background'];?>" );
<?php } ?>


<?php if ( !empty ( $ad['0']['paud_border'] ) ) { ?>
	$( "#ad-design-div" ).css( "border", "1px solid <?php echo $ad['0']['paud_border'];?>" );
<?php } ?>

$("#ad-design-div").show();



});
</script>




<?php echo $footer;?>