var createAd_form_width;
var createAd_currentForm = 'normal';
var createAd_fieldHasFocus = false;
var createAd_animateActive = false;

function ss_toggleSubmitBtn(div){
	if (div == 'load') {
		$('#btn_submit_div').hide();
		$('#btn_submit_div2').hide();
		$('#btn_load_div').show();
	}
	else {
		$('#btn_submit_div').show();
		$('#btn_submit_div2').show();
		$('#btn_load_div').hide();
	}
	return false;
}
function ss_checkout_changeCountry(){
	var country = $('#userCountry').val();
	if (country == '1') {
		$('#selfserve_state').fadeIn();
		$('#selfserve_province').hide();
	}
	else if (country == '2') {
		$('#selfserve_province').fadeIn();
		$('#selfserve_state').hide();
	}
	else {
		$('#selfserve_state').fadeOut();
		$('#selfserve_province').fadeOut();
	}
}
function ss_checkout_submit() {
	var cardType = $('#cardType').val();
	var cardNumber = $('#cardNumber').val();
	var cardExpiryMonth = $('#cardExpiryMonth').val();
	var cardExpiryYear = $('#cardExpiryYear').val();
	var cardCVV = $('#cardCVV').val();
	var userTitle = $('#userTitle').val();
	var userFirstName = $('#userFirstName').val();
	var userLastName = $('#userLastName').val();
	var userAddress = $('#userAddress').val();
	var userCountry = $('#userCountry').val();
	var userState = $('#userState').val();
	var userProvince = $('#userProvince').val();
	//var userCity = $('#userCity').val();
	var userZip = $('#userZip').val();
	//var userPhone = $('#userPhone').val();
	var emailAlert = $('input[name=opt_email_alert]').is(':checked');
	
	if (ss_trim(new String(cardNumber)) == '' || cardNumber == 'null') {alert('Please enter your credit card number.');$('#cardNumber').focus();return false;}
	else if (ss_trim(new String(cardExpiryMonth)) == '-1' || cardExpiryMonth == 'null') {alert('Please select your card expiry month.');$('#cardExpiryMonth').focus();return false;}
	else if (ss_trim(new String(cardExpiryYear)) == '-1' || cardExpiryYear == 'null') {alert('Please select your card expiry year.');$('#cardExpiryYear').focus();return false;}
	else if (ss_trim(new String(cardCVV)) == '' || cardCVV == 'null') {alert('Please enter your card CVV.');$('#cardCVV').focus();return false;}
	else if (ss_trim(new String(userFirstName)) == '' || userFirstName == 'null') {alert('Please enter your first name.');$('#userFirstName').focus();return false;}
	else if (ss_trim(new String(userLastName)) == '' || userLastName == 'null') {alert('Please enter your last name.');$('#userLastName').focus();return false;}
	else if (ss_trim(new String(userAddress)) == '' || userAddress == 'null') {alert('Please enter your address.');$('#userAddress').focus();return false;}
	else if (ss_trim(new String(userCountry)) == '-1' || userCountry == 'null') {alert('Please select your country.');$('#userCountry').focus();return false;}
	if (userCountry == '1') {
		if (ss_trim(new String(userState)) == '-1' || userState == 'null') {alert('Please select your State.');$('#userState').focus();return false;}
	}
	if (userCountry == '2') {
		if (ss_trim(new String(userProvince)) == '-1' || userProvince == 'null') {alert('Please select your Province.');$('#userProvince').focus();return false;}
	}
	if (ss_trim(new String(userZip)) == '' || userZip == 'null') {alert('Please enter your zipcode or postal code.');$('#userZip').focus();return false;}
	
	var optins = '';
	for (i = 0; i < 30; i++) {
		if ($('input[name=opt\['+i+'\]]').is(':checked')) {
			value = $('input[name=opt\['+i+'\]]').val();
			optins += value+',';
			
		}
	}
	ss_toggleSubmitBtn('load');
	$('#checkOut').submit();
	
}
function ss_createAd_expandForm(field){
	if (createAd_currentForm == 'normal' && createAd_animateActive == false) {
		createAd_currentForm = 'expand';
		createAd_animateActive = true;
		createAd_form_width = $('#selfserve_ad_create_form').css('width');
		$('#selfserve_ad_create_left').hide();
		$('#selfserve_ad_create_form').animate({width: '100%'}, 400);
		var w = $('#selfserve_ad_create_preview').css('width');
		$('#selfserve_ad_create_preview').css('width', 0);
		setTimeout(function(){$('#selfserve_ad_create_preview').show();$('#selfserve_ad_create_preview').animate({width: w}, 500);}, 200);
		setTimeout(function(){createAd_animateActive = false;}, 700);
		$(field).blur();
		setTimeout(function(){$(field).focus()}, 600);
		ss_createAd_updatePreview();
	}
}
function ss_createAd_normalForm(){
	if (createAd_currentForm == 'expand' && createAd_animateActive == false) {
		createAd_animateActive = true;
		createAd_currentForm = 'normal';
		$('#selfserve_ad_create_form').animate({width: createAd_form_width}, 400);
		setTimeout(function(){$('#selfserve_ad_create_left').show();}, 400);
		setTimeout(function(){createAd_animateActive = false;}, 400);
		$('#selfserve_ad_create_preview').hide();
	}
}
function ss_createAd_submit() {
	var title = new String($('#adTitle').val());
	var description = new String($('#adDescription').val());
	var location = new String($('#adLocation').val());
	var industry = new String($('#adIndustry').val());
	var website = new String($('#adWebsite').val());
	if (ss_trim(title) == '' || title == 'null') {
		alert('The Ad Title field is empty. Please enter your Ad Title here.');
		$('#adTitle').focus();
		return false;
	}
	else if (ss_trim(description) == '' || description == 'null' ){
		alert('The Ad Description field is empty. Please enter your Ad Description here.');
		$('#adDescription').focus();
		return false;
	}
	else if(ss_trim(location) == '' || location == 'null'){
		alert('The Location field is empty. Please enter the Location your ad is targetting.');
		$('#adLocation').focus();
		return false;
	}
	else if(ss_trim(industry) == '' || industry == 'null'){
		alert('The Industry field is empty. Please enter the Industry your ad is targetting.');
		$('#adIndustry').focus();
		return false;
	}
	/*
	else if(ss_trim(createAd_photo) == '' || createAd_photo == 'null'){
		alert('Please upload a photo for your ad. Make the photo relate to your ad for better results.');	
		return false;
		
		
	}
	*/
	else if(ss_trim(website) != '' && website != 'null'){
		if (!ss_validateURL(website)) {
			alert('The Destination URL is invalid. (Valid example: www.salespider.com)');
			$('#adWebsite').focus();
			return false;
		}
		
	}
	
	title = (ss_trim(title) == '' || title == 'null') ? '': Base64url.encode(title);
	description = (ss_trim(description) == '' || description == 'null' ) ? '': Base64url.encode(description);
	location = (ss_trim(location) == '' || location == 'null') ? '': Base64url.encode(location);
	industry = (ss_trim(industry) == '' || industry == 'null') ? '': Base64url.encode(industry);
	website = (ss_trim(website) == '' || website == 'null') ? '': Base64url.encode(website);
	ss_toggleSubmitBtn('load');
	$.post("/selfserve/ajax/ad_create_ajax.php",
		{ "title": title, "description": description, "locstr":location, "industry": industry, "website":website  },
		function (data) {
			if (data) {
				if (data.error == '1') {
					alert(data.message);
					ss_toggleSubmitBtn('btn');
					return false;
				}
				else {
					window.location = data.message;
					return false;
				}
			} else {
				alert('There was a problem submitting your form.  Please refresh and try again.');
				ss_toggleSubmitBtn('btn');
				return false;
			}
		}, "json");
	
}
function ss_editAd_submit(id) {
	var title = new String($('#adTitle').val());
	var description = new String($('#adDescription').val());
	var location = new String($('#adLocation').val());
	var industry = new String($('#adIndustry').val());
	var website = new String($('#adWebsite').val());
	if (ss_trim(title) == '' || title == 'null') {
		alert('The Ad Title field is empty. Please enter your Ad Title here.');
		$('#adTitle').focus();
		return false;
	}
	else if (ss_trim(description) == '' || description == 'null' ){
		alert('The Ad Description field is empty. Please enter your Ad Description here.');
		$('#adDescription').focus();
		return false;
	}
	else if(ss_trim(location) == '' || location == 'null'){
		alert('The Location field is empty. Please enter the Location your ad is targetting.');
		$('#adLocation').focus();
		return false;
	}
	else if(ss_trim(industry) == '' || industry == 'null'){
		alert('The Industry field is empty. Please enter the Industry your ad is targetting.');
		$('#adIndustry').focus();
		return false;
	}
	/*
	else if(ss_trim(createAd_photo) == '' || createAd_photo == 'null'){
		alert('Please upload a photo for your ad. Make the photo relate to your ad for better results.');
		return false;
		
		
	}
	*/
	else if(ss_trim(website) != '' && website != 'null'){
		if (!ss_validateURL(website)) {
			alert('The Destination URL is invalid. (Valid example: www.salespider.com)');
			$('#adWebsite').focus();
			return false;
		}
		
	}
	title = (ss_trim(title) == '' || title == 'null') ? '': Base64url.encode(title);
	description = (ss_trim(description) == '' || description == 'null' ) ? '': Base64url.encode(description);
	location = (ss_trim(location) == '' || location == 'null') ? '': Base64url.encode(location);
	industry = (ss_trim(industry) == '' || industry == 'null') ? '': Base64url.encode(industry);
	website = (ss_trim(website) == '' || website == 'null') ? '': Base64url.encode(website);
	ss_toggleSubmitBtn('load');
	$.post("/selfserve/ajax/ad_edit_ajax.php",
		{ "title": title, "description": description, "locstr":location, "industry": industry, "website":website, "id":id  },
		function (data) {
			if (data) {
				if (data.error == '1') {
					alert(data.message);
					ss_toggleSubmitBtn('btn');
					return false;
				}
				else {
					alert('You ad was updated!');
					window.location = data.message;
					return false;
				}
			} else {
				alert('There was a problem submitting your form.  Please refresh and try again.');
				ss_toggleSubmitBtn('btn');
				return false;
			}
		}, "json");
	
}


function ss_createAd_preview() {
	var title = new String($('#adTitle').val());
	var description = new String($('#adDescription').val());
	var location = new String($('#adLocation').val());
	
	var industry = new String($('#adIndustry').val());
	var website = new String($('#adWebsite').val());
	
	title = (ss_trim(title) == '' || title == 'null') ? '': Base64url.encode(title);
	description = (ss_trim(description) == '' || description == 'null' ) ? '': Base64url.encode(description);
	location = (ss_trim(location) == '' || location == 'null') ? '': Base64url.encode(location);
	industry = (ss_trim(industry) == '' || industry == 'null') ? '': Base64url.encode(industry);
	website = (ss_trim(website) == '' || website == 'null') ? '': Base64url.encode(website);
	photo = (ss_trim(createAd_photo) == '' || createAd_photo == 'null') ? '': Base64url.encode(createAd_photo);
	preview_ad_win = window.open('/selfserve/preview.php?title='+title+'&description='+description+'&locstr='+location+'&industry='+industry+'&website='+website+'&photo='+photo, 'preview_ad_win', "menubar=0,resizable=1,location=0,width=820,height=550");
	window.preview_ad_win.focus();
	
}
function ss_printable_version(version) {
	if (version == 'sstos') {
		printable_tos_win = window.open('/selfserve/salespider_tos_printable.html','sstos', "menubar=0,resizable=1,width=750,height=550,scrollbars=1");
		window.printable_tos_win.focus();
	}
	else if (version == 'ptos') {
		printable_tos_win = window.open('/selfserve/payment_tos_printable.html','ptos', "menubar=0,resizable=1,width=750,height=550,scrollbars=1");
		window.printable_tos_win.focus();
	}
}
preview_click_text = '';
function ss_createAd_updatePreview() {
	var title = ($('#adTitle').val().length <=  26) ? $('#adTitle').val() : $('#adTitle').val().substring(0, 26);
	var desc = ($('#adDescription').val().length <= 72) ? $('#adDescription').val() : $('#adDescription').val().substring(0, 72);
	var website = ($('#adWebsite').val());
	var photourl = createAd_photo;
	var photo = '';
	title = ss_ucwords(ss_strtolower(ss_wordwrap(ss_trim(title), 19, ' ', true)));
	desc = ss_ucfirst(ss_wordwrap(ss_trim(desc), 19, ' ', true));
	if (ss_trim(new String(title)) != '' && title != 'null') {
		title = ss_strip_tags(title);
		if (ss_trim(new String(website)) != '' && website != 'null') {
			website = ss_urlInsertProtocol(website);
			title = '<a href="'+website+'" title="Go to your destination URL" target="_blank">'+title+'</a><span id="preview_click_full_text" style="font-weight:normal; font-size:0.8em; color:red"></span>';
			photo = '<a href="'+website+'" title="Go to your destination URL" target="_blank"><img src="'+photourl+'" class="selfserve_preview_photo_container"></a>';
		}
		else {
			title = '<a href="#" onClick="ss_createAd_preview();" title="A full preview will open up in a new window">'+title+'</a><span id="preview_click_full_text" style="font-weight:normal; font-size:0.8em; color:red"></span>';
			photo = '<a href="#" onClick="ss_createAd_preview();" title="A full preview will open up in a new window"><img src="'+photourl+'" class="selfserve_preview_photo_container"></a>';
		}
	}
	else {
		title = 'Start writing an Ad Title';
		photo = '<img src="'+photourl+'" class="selfserve_preview_photo_container">';
		
	}
	if (ss_trim(new String(desc)) == '' || desc == 'null') {
		desc = 'Start writing an Ad Description';
	}
	
	$('#preview_title').html(title);
	$('#preview_photo').html(photo);
	$('#preview_description').html(ss_strip_tags(desc));
	//clearTimeout(preview_click_text);
	//preview_click_text = setTimeout(function(){$('#preview_click_full_text').fadeOut()}, 2000);
}
function ss_login_create() {
	var email =  new String($('#email').val());
	var interests =  new String($('#interests').val());
	var companySize =  new String($('#companySize').val());
	var password =  new String($('#password').val());
	var repeatPassword =  new String($('#repeatPassword').val());
	if (ss_trim(email) == '') { alert('Please enter in your E-mail address.'); $('#email').focus(); return false;}
	else if (ss_trim(password) == '') { alert('Please create a password.'); $('#password').focus(); return false;}
	else if (ss_trim(repeatPassword) == '') { alert('Please repeat your password.'); $('#repeatPassword').focus(); return false;}
	else if (ss_trim(interests) == '' || interests == '-1') { alert('Please select your category of interests.'); $('#interests').focus(); return false;}
	else if (ss_trim(companySize) == '') { alert('Please select the number of employees in your company.'); $('#companySize').focus(); return false;}
	
	else if (password.toString() != repeatPassword.toString()) {alert('Your passwords are not the same. Please enter your passwords correctly.'); $('#repeatPassword').focus(); return false;}
	
	else {
		email = (ss_trim(email) == '' || email == 'null') ? '': Base64url.encode(email);
		interests = (ss_trim(interests) == '' || interests == 'null' ) ? '': Base64url.encode(interests);
		companySize = (ss_trim(companySize) == '' || companySize == 'null') ? '': Base64url.encode(companySize);
		password = (ss_trim(password) == '' || password == 'null') ? '': Base64url.encode(password);
		repeatPassword = (ss_trim(repeatPassword) == '' || repeatPassword == 'null') ? '': Base64url.encode(repeatPassword);
		ss_toggleSubmitBtn('load');
		$.post("/selfserve/ajax/ad_login_ajax.php",
			{ "action":"create", "email": email, "interests": interests, "companysize":companySize, "password": password, "repeatpassword":repeatPassword  },
			function (data) {
				if (data) {
					if (data.error == '1') {
						alert(data.message);
						$('#'+data.field).focus();
						ss_toggleSubmitBtn('btn');
						return false;
					}
					else {
						window.location = data.message;
						return false;
					}
				} else {
					alert('There was a problem submitting your form.  Please refresh and try again.');
					ss_toggleSubmitBtn('btn');
					return false;
				}
			}, "json");
	}
}
function ss_login_signin() {
	var email =  new String($('#email').val());
	var password =  new String($('#password2').val());
	if (ss_trim(email) == '') { alert('Please enter in your E-mail address.'); $('#email').focus(); return false;}
	else if (ss_trim(password) == '') { alert('Please enter your password for your SaleSpider account.'); $('#password2').focus(); return false;}
	
	else {
		email = (ss_trim(email) == '' || email == 'null') ? '': Base64url.encode(email);
		password = (ss_trim(password) == '' || password == 'null') ? '': Base64url.encode(password);
		ss_toggleSubmitBtn('load');
		$.post("/selfserve/ajax/ad_login_ajax.php",
			{ "action":"login", "email": email,  "password": password },
			function (data) {
				if (data) {
					if (data.error == '1') {
						alert(data.message);
						$('#'+data.field).focus();
						ss_toggleSubmitBtn('btn');
						return false;
					}
					else {
						window.location = data.message;
						return false;
					}
				} else {
					alert('There was a problem submitting your form.  Please refresh and try again.');
					ss_toggleSubmitBtn('btn');
					return false;
				}
			}, "json");
	}
}
function ss_login_toggleUserType(type) {
	if (type == 'old') {
		$('#selfserve_ad_login_new_customer').fadeOut();
		$('#selfserve_ad_login_old_customer').fadeIn();
	}
	else {
		$('#selfserve_ad_login_old_customer').fadeOut();
		$('#selfserve_ad_login_new_customer').fadeIn();
	}
	
}
function ss_overlay(id, action) {
	if (action == 'on') {
		position = $('#'+id).position();
		if (position) {
			$('#overlay_shadow').css('left', position.left);
			$('#overlay_shadow').css('top', position.top);
			$('#overlay_shadow').css('width', $('#'+id).width());
			$('#overlay_shadow').css('height', $('#'+id).height());
			$('#overlay_shadow').css('opacity', 0.5);
			$('#overlay_shadow').fadeIn();
			
			$('#overlay_content').css('left', position.left + ( ($('#'+id).width()-$('#overlay_content').width()) / 2));
			$('#overlay_content').css('top', position.top + ( ($('#'+id).height()-$('#overlay_content').height()) / 2));
			
			$('#overlay_content').fadeIn();
		}
	}
	else {
		$('#overlay_shadow').fadeOut();
		$('#overlay_content').fadeOut();
	}
}
function ss_order_calculate(tier) {
	var tierId;
	var promocode = new String($('#promocode').val());
	var selectNewsfeed = new String($('input[name="addonSelectNewsfeed"]:checked').val());
	if (tier == '1') {
		tierId = 1;
	}
	else if (tier == '2') {
		tierId = 2;
	}
	else if (tier == '3') {
		tierId = 3;
	}
	else if (tier == 'promo') {
		tierId = new String($('input[name="tierNumber"]:checked').val());
		if (tierId == 'undefined' || tierId == 'null') {
			alert('Please select a price.');
			$('#tier2').focus();
			return false;
		}
	}
	else if (tier == 'addon') {
		tierId = new String($('input[name="tierNumber"]:checked').val());
	}
	ss_overlay('selfserve_price_container', 'on');
	$.post("/selfserve/ajax/ad_order_calculate_ajax.php",
		{ "tierId":tierId.toString(), "promocode": promocode.toString(), "addonNewsfeed" : selectNewsfeed.toString() },
		function (data) {
			if (data) {
				if (data.error == '1') {
					alert(data.message);
					$('#'+data.field).focus();
				}
				else {
					$('#priceUnit').html(data.html_unit);
					$('#priceYour').html(data.html_your);
					$('#priceTotal').html(data.html_total);
					$('#priceSubtotal').html(data.html_subtotal);
					if (data.message != '') {
						alert(data.message);
						$('#'+data.field).focus();
					}
				}
			} else {
				ss_overlay('selfserve_price_container', 'off');
				alert('There was a problem submitting your form.  Please refresh and try again.');
				
			}
		}, "json");
	ss_overlay('selfserve_price_container', 'off');
	return false;
	
}
function ss_order_submit() {
	var promocode = new String($('#promocode').val());
	var tierId = new String($('input[name="tierNumber"]:checked').val());
	var agreeSSTos = 'no';
	var selectNewsfeed = new String($('input[name="addonSelectNewsfeed"]:checked').val());
	if ($('#agreeSSTos').is(':checked')) {
		agreeSSTos = $('#agreeSSTos').val();;
	}
	if (tierId == 'undefined' || tierId == 'null') {
		alert('Please select a price.');
		$('#tier2').focus();
		return false;
	}
	else if (agreeSSTos != 'yes') {
		alert('You must agree to the Term of Services.');
		$('#agreeSSTos').focus();
		return false;
	}
	
	ss_toggleSubmitBtn('load');
	$.post("/selfserve/ajax/ad_order_ajax.php",
		{ "tierId":tierId.toString(), "promocode": promocode.toString(), "agreesstos": agreeSSTos, "addonNewsfeed" : selectNewsfeed.toString()   },
		function (data) {
			if (data) {
				if (data.error == '1') {
					alert(data.message);
					$('#'+data.field).focus();
					ss_toggleSubmitBtn('btn');
				}
				else {
					window.location = data.message;
					return false;
				}
			} else {
				ss_toggleSubmitBtn('btn');
				alert('There was a problem submitting your form.  Please refresh and try again.');
				
			}
		}, "json");
	return false;
}
function ss_trim(s) {
	return s.replace(/^\s+|\s+$/g,"");
}
function ss_strip_tags(html)
{
   var tmp = document.createElement("DIV");
   tmp.innerHTML = html;
   return tmp.textContent||tmp.innerText;
}
function ss_savePhotoResume() {
	var resume = $('#resume').val();
	ss_toggleSubmitBtn('load');
	$.get("/selfserve/ajax/upgrade_form.php",
		{ "update": 1 , "resume": resume },
		function (data) {
			if (data.length > 0) {
				window.location = '/index.php';
			} else {
				alert("Sorry, there was a problem saving your changes.");
				ss_toggleSubmitBtn('btn');
			}
		}
		);
	
}

function ss_ismaxlength(obj){
	var mlength=$(obj).attr('maxlength') ? parseInt($(obj).attr('maxlength')) : "";
	if ($(obj).attr('maxlength') && $(obj).val().length>mlength)
		$(obj).val($(obj).val().substring(0,mlength));
}

function ss_wordwrap(str, int_width, str_break, cut) {
    // PHP Defaults
    var m = ((arguments.length >= 2) ? arguments[1] : 75   );
    var b = ((arguments.length >= 3) ? arguments[2] : " " );
    var c = ((arguments.length >= 4) ? arguments[3] : false);

    var i, j, l, s, r;

    str += '';

    if (m < 1) {
        return str;
    }

    for (i = -1, l = (r = str.split(/\r\n|\n|\r/)).length; ++i < l; r[i] += s) {
        for (s = r[i], r[i] = ""; s.length > m; r[i] += s.slice(0, j) + ((s = s.slice(j)).length ? b : "")){
            j = c == 2 || (j = s.slice(0, m + 1).match(/\S*(\s)?$/))[1] ? m : j.input.length - j[0].length || c == 1 && m || j.input.length + (j = s.slice(m).match(/^\S*/)).input.length;
        }
    }
    
    return r.join("\n");
}

function ss_validateURL(url)
{
	url = ss_trim(url);
	url = ss_urlInsertProtocol(url);
	lengthValue = url.length;
	if(lengthValue != 0)
	{
		var j = new RegExp();
		j.compile("^(http|https)://[A-Za-z0-9-]+(\.[A-Za-z0-9]+)+(.+)", "i");
		if (!j.test(url))
		{
			return false;
		}
	}
	return true;
}
function ss_urlInsertProtocol(url)
{
	url = ss_trim(url);
	lengthValue = url.length;
	if(lengthValue != 0)
	{
		var j = new RegExp();
		j.compile("^(http|https)://(.+)", "i");
		if (!j.test(url))
		{
			url = 'http://'+url;
			
		}
		
	}
	return url;
}
function ss_ucwords(str) {
    return (str + '').replace(/^(.)|(\s+)(.)/g, function ($1) {
        return $1.toUpperCase();
    });
}
function ss_strtolower(str) {
    return (str+'').toLowerCase();
}
function ss_ucfirst(str) {
    str += '';
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1);
}
function ss_ajaxAdImageUpload() {
	$("#loading_photo")
	.ajaxStart(function(){
			$(this).show();
	})
	.ajaxComplete(function(){
			$(this).hide();
	});
	
	$.ajaxFileUpload
	(
		{
			url:'/selfserve/ajax/upload_ad_image.php',
			secureuri:false,
			fileElementId:'photo',
			dataType: 'json',
			success: function (data, status) {
				if(typeof(data.error) != 'undefined') {
					if(data.error != '') {
						alert(data.error);
					} else {
						createAd_photo = data.msg;
						ss_createAd_updatePreview();
					}
				}
			},
			error: function (data, status, e) {
				alert(e);
			}
		}
		)
	
	return false;
}



