// These scripts are powered by jQuery...

// execute when DOM is ready
jQuery(document).ready(function($) {

// modals
$("#modal").dialog({
	bgiframe: true,
	autoOpen: false,
	width:480,
	modal: true
});
// open modal
$("button[rel='modal']").click(function() {
	$("#modal").dialog("open");
});

// click outside modal to close
$(".ui-widget-overlay", "body:has(#modal)").live("click", function() {
	$("#modal").dialog("close");
});

// table sorter
$("body.pricesigns table.style").tablesorter({ 
	// disable headers (zero index, i.e. 0 = 1st column) 
	headers: { 
		0: { sorter: false }, 
		3: { sorter: false }, 
		4: { sorter: false }, 
		5: { sorter: false }, 
		6: { sorter: false }, 
		7: { sorter: false }, 
		8: { sorter: false }, 
		9: { sorter: false }   
	} 
});

// table row hover
$("table.style tr").hover(
	function() {$(this).addClass("hover");},
	function() {$(this).removeClass("hover");}
);

// inline labels
$(':input.inlinelabel').inlineLabel();

// date picker
$(".datepicker").datepicker();


// ADD/EDIT DIALOG BOXES
// ------------------------------------------------------------------------------

$("#eventhide").hide();
var dialogBox = $("#dialog"),
	msg = $("#dialog-message"),
	msgOrigText = msg.text(),
	allFields = $(":input:not(:radio, :button)", dialogBox);
	defaultCheckedFields = $(":checked", dialogBox);
var priceSignSearch = $("body.pricesigns #search"),
	signsearch = $(":input#txtSearch",priceSignSearch);

var	signageDialogBox = $("body.signage #dialog"),
	signageHeading = $(":input#txtHeading", signageDialogBox),
	signageParagraph = $(":input#txtParagraph", signageDialogBox);
// FAQ page
var	faqDialogBox = $("body.faq #dialog"),
	faqQuestion = $(":input#txtQ", faqDialogBox),
	faqAnswer = $(":input#txtA", faqDialogBox),
	faqId = $(":input#faq_id", faqDialogBox),
	faqFields = $([]).add(faqQuestion).add(faqAnswer).add(faqId);
// Events page
var	eventsDialogBox = $("body.events #dialog"), 
	eventName = $(":input#txtName",eventsDialogBox),
	eventStart = $(":input#txtStart", eventsDialogBox),
	eventEnd = $(":input#txtEnd", eventsDialogBox),
	eventActive = $(":input#radActiveYes", eventsDialogBox),
	eventActiveYes = $(":input#radActiveYes", eventsDialogBox),
	eventActiveNo = $(":input#radActiveNo", eventsDialogBox),
	eventId = $(":input#eventIdHide", eventsDialogBox),
	eventsFields = $([]).add(eventName).add(eventStart).add(eventEnd).add(eventId);
	
// Admin page
var	adminDialogBox = $("body.admin #dialog"),
	adminName = $(":input#txtName", adminDialogBox),
	adminEmail = $(":input#txtEmail", adminDialogBox),
	adminPassword = $(":input#txtPassword", adminDialogBox),
	adminPasswordConfirm = $(":input#txtPasswordConfirm"),
	adminRole = $(":input#selRole", adminDialogBox),
	adminStore = $(":input#txtStore", adminDialogBox),
	adminActiveYes = $(":input#radActiveYes", adminDialogBox),
	adminActiveNo = $(":input#radActiveNo", adminDialogBox),
	adminFields = $([]).add(adminName).add(adminEmail).add(adminPassword).add(adminStore);
	
// dialog messages
function updateMessage(t) {
	msg.text(t).effect("highlight",{},1500);
}

// form field length validator
function checkLength(o,n,min,max) {
	var min = (min == null) ? 4 : min; // default value
	var max = (max == null) ? 100 : max; // default value
	if ( o.val().length > max || o.val().length < min ) {
		o.addClass("ui-state-error");
		updateMessage("Length of " + n + " must be between "+min+" and "+max+" characters.");
		return false;
	} else {
		return true;
	}
}

// initialize dialog
dialogBox.dialog({
	bgiframe: true,
	autoOpen: false,
	width: 400,
	modal: true,
	close: function() {
		allFields.val("").removeClass("ui-state-error");
		// return all checkboxes and radio buttons back to default state
		defaultCheckedFields.each(function() {
			$(this)[0].checked = true;
		});
		msg.text(msgOrigText);
	}
});
eventsDialogBox.dialog('option', 'width', 420);
faqDialogBox.dialog('option', 'width', 450);
signageDialogBox.dialog('option', 'width', 510);

// 'update' button - Signage Standards page
$("button.update", signageDialogBox).click(function() {
	var bValid = true;
	allFields.removeClass("ui-state-error");

	bValid = bValid && checkLength(signageHeading,"question",4,200);
	bValid = bValid && checkLength(signageParagraph,"answer",4,400);
	
	if (bValid) {
		console.log(signageHeading.val()); 
		console.log(signageParagraph.val()); 
		dialogBox.dialog("close");
		return true;
	}
	return false;
});

// 'update' button - FAQ page
$("button.update", faqDialogBox).click(function() {
	var bValid = true;
	allFields.removeClass("ui-state-error");

	bValid = bValid && checkLength(faqQuestion,"question",10,300);
	bValid = bValid && checkLength(faqAnswer,"answer",1,300);
	
	if (bValid) {
		console.log(faqQuestion.val()); 
		console.log(faqAnswer.val()); 
		dialogBox.dialog("close");
		return true;
	}
	return false;
});

// 'update' button - Events page
$("button.update", eventsDialogBox).click(function() {
	var bValid = true;
	allFields.removeClass("ui-state-error");

	bValid = bValid && checkLength(eventName,"event name");
	bValid = bValid && checkLength(eventStart,"start date",6,10);
	bValid = bValid && checkLength(eventEnd,"end date",6,10);
	
	if (bValid) {
		console.log(eventName.val()); 
		console.log(eventStart.val()); 
		console.log(eventEnd.val()); 
		dialogBox.dialog("close");
		return true;
	}
	return false;
});

// uncomplete function
// 'pricesign' submit button 
$("button.submit",priceSignSearch).click(function() {
	var bValid= true;
	allFields.removeClass("ui-state-error");
	
	alert('Are you sure you want to give us the deed to your house?'); 
	
	bValid = bValid && checkLength(signsearch,"Search");
	
});	


// uncomplete function

// 'update' button - Admin page
$("button.update", adminDialogBox).click(function() {
	var bValid = true;
	allFields.removeClass("ui-state-error");

	bValid = bValid && checkLength(adminName,"user name");
	bValid = bValid && checkLength(adminEmail,"email");
	bValid = bValid && checkLength(adminPassword,"password",6,10);
	bValid = bValid && checkLength(adminStore,"store #",3,8);
	
	if (bValid) {
		dialogBox.dialog("close");
	}
});	

// 'cancel' button
$("button.cancel", dialogBox).click(function() {
	dialogBox.dialog("close");
});	

// 'edit/update' mode - Signage Standards page
$("body.signage button.edit").click(function() {
	var headingEdit = $("h3:first").text(),
		paragraphEdit = $("p:first").text();
	signageHeading.val(headingEdit);
	signageParagraph.val(paragraphEdit);
});

// 'edit/update' mode - FAQ page
$("body.faq button.edit").click(function() {
	var questionEdit = $(this).prev().text(),
		answerEdit = $(this).parent().next().text(),
		faqIdEdit = $(this).parent().siblings("#faqId").val();
	faqQuestion.val(questionEdit);
	faqAnswer.val(answerEdit);
	faqId.val(faqIdEdit);
	
});

// 'edit/update' mode - Events page
$("body.events button.edit").click(function() {
	var nameEdit = $(this).parent().siblings(".eventName").text(),
		startEdit = $(this).parent().siblings(".eventStart").text(),
		endEdit = $(this).parent().siblings(".eventEnd").text(),
		activeEdit = $(this).parent().siblings(".eventActive").text(),
		eventEdit=$(this).parent().siblings(".eventId").text();
		
	eventName.val(nameEdit);
	eventStart.val(startEdit);
	eventEnd.val(endEdit);
	eventId.val(eventEdit);
	if (activeEdit == "1") {
		eventActiveYes[0].checked = true; 
	}
	else {
		eventActiveNo[0].checked = true;
	}
});

// 'edit/update' mode - Admin page
$("body.admin button.edit").click(function() {
	var nameEdit = $(this).parent().siblings(".userName").text(),
		roleEdit = $(this).parent().siblings(".userRole").text(),
		storeEdit = $(this).parent().siblings(".userStore").text(),
		activeEdit = $(this).parent().siblings(".userActive").text();
		
	adminName.val(nameEdit);
	adminStore.val(storeEdit);
	
	if (activeEdit == "Yes") {
		adminActiveYes[0].checked = true;
	}
	else {
		adminActiveNo[0].checked = true;
	}
});

// 'edit/update' mode
$("button.edit").click(function() {
	changeDialogMode("edit");
	dialogBox.dialog("open");
});	

// 'add new' mode
$("button.add").click(function() {
	changeDialogMode("add");
	dialogBox.dialog("open");
});

// change dialog mode
var dialogTitle = $(".ui-dialog-title"),
	dialogButton = $("button.update"),
	defaultTitleText = dialogTitle.text(),
	defaultButtonText = dialogButton.text();
function changeDialogMode(mode) {
	switch (mode) {
		case "add":
			var titleReplaceText = "Add New",
				titleText = defaultTitleText.replace("Update", titleReplaceText),
				buttonText = "Add";
			dialogBox.dialog("option", "title", titleText);
			dialogButton.text(buttonText);
			break;
		case "edit":
			dialogBox.dialog("option", "title", defaultTitleText);
			dialogButton.text(defaultButtonText);
			break;
		case "print":
			dialogBox.dialog("option", "title", defaultTitleText);
			dialogButton.text(defaultButtonText);
	}
}

//PREVIEW DIALOG BOXES
//------------------------------------------------------------------------------

var dialogPreview = $("#dialog-preview"),
	dialogPreviewCart = $("body.cart #dialog-preview"),
	dialogPreviewCustom = $("body.custom #dialog-preview");

//initialize dialog
dialogPreview.dialog({
	autoOpen: false,
	width: 600,
	modal: true
});

//Cart Page

//'Preview' button
$("body.cart button.preview").click(function() {
	var pdfUrl = $(this).closest(".item").find("input.pdfUrl").val();
	var newPrice = $(this).closest(".item").find("input.new_price").val();
	//alert('pdf url: '+pdfUrl+'/'+ltrim(newPrice));
	$("iframe", dialogPreviewCart).attr("src",pdfUrl+'/'+ltrim(newPrice));
	//dialogPreviewCart.dialog("open");
});
//click outside modal to close
$(".ui-widget-overlay", "body.cart").live("click", function() {
	dialogPreviewCart.dialog("close");
});
// ltrim function 
function ltrim(text) {
	return text.replace("$","");
    //return text.replace(/^\s+|\s+$/g,'');
}

// CART PAGE
// ------------------------------------------------------------------------------

// paper layout click
$(".paperlayout td").click(function() {
	$(":radio", this)[0].checked = true;
});

// cart jump nav div heights
var heights = [];
$("body.cart #pagenav div").each(function(i) {
	heights[i] = $(this).height();
});
$("body.cart #pagenav div").height(Array.max(heights));


// FAQ PAGE
// ------------------------------------------------------------------------------

// make question and answer same height
$("body.faq dt").faqAdjustHeight();
	
// add CSS class "first" to first row
$("body.faq dl").each(function() {
	$("dt:first, dd:first", this).addClass("first");
});

// drag sort dialog
var dialogSort = $("#dialog-sort");
// initialize dialog
dialogSort.dialog({
	autoOpen: false,
	width: 700,
	modal: true,
	open: function() {
		$(".sortable").sortable({
			// update sort order numbers
			update: function() {
				$(this).children().each(function(i){
					i++; // start with 1 instead of 0
					// update label
					$("span.num", this).text(i+".");
					// update hidden field
					$("input#faqId", this).val(i);
				});
			}
		})			
	},
	close: function() {
		$(".sortable").sortable("destroy");
	}
});
// 'Change FAQ Order' button
$("body.faq button.order").click(function() {
	dialogSort.dialog("open");
});
// 'Cancel' button
$("button.cancel", dialogSort).click(function() {
	dialogSort.dialog("close");
});	
// 'Update' button
$("button.update", dialogSort).click(function() {
	dialogSort.dialog("close");
});	


// pricesign validate 
// ------------------------------------------------------------------------------

$('#frmPricesignsPreview').submit(function() {
	
	//var chks = document.getElementsByName('chkSelect[]');
	var chks = $('*[name=chkSelect[]]');
	var hasChecked = false;
	for (var i = 0; i < chks.length; i++){
		if (chks[i].checked){
			hasChecked = true;
			break;
		}
	}
	if (hasChecked == false){
		alert("Please select at least one sign.");
		return false;
	}
	return true;
	
});
// cart quantity calculate 
//-------------------------------------------------------------------------------

//signstock validate 
//------------------------------------------------------------------------------

$('#frmSignStock').submit(function() {
	
	var chksred1 = $("#txtQtyred1").val();
	var chksred2 = $("#txtQtyred2").val();
	var chksred3 = $("#txtQtyred3").val();
	var chksred4 = $("#txtQtyred4").val();
	
	var chksyellow1 = $("#txtQtyYellow1").val();
	var chksyellow2 = $("#txtQtyYellow2").val();
	var chksyellow3 = $("#txtQtyYellow3").val();
	var chksyellow4 = $("#txtQtyYellow4").val();
	
	var chkswhite1 = $("#txtQtyWhite1").val();
	var chkswhite2 = $("#txtQtyWhite2").val();
	var chkswhite3 = $("#txtQtyWhite3").val();
	var chkswhite4 = $("#txtQtyWhite4").val();
		
	var hasChecked = false;
	if(chksred1 !==""){
		hasChecked = true;
	}
	if(chksred2 !==""){
		hasChecked = true;
	}
	if(chksred3 !==""){
		hasChecked = true;
	}
	if(chksred4 !==""){
		hasChecked = true;
	}
	if(chksyellow1 !==""){
		hasChecked = true;
	}
	if(chksyellow2 !==""){
		hasChecked = true;
	}
	if(chksyellow3 !==""){
		hasChecked = true;
	}
	if(chksyellow4 !==""){
		hasChecked = true;
	}
	if(chkswhite1 !==""){
		hasChecked = true;
	}
	if(chkswhite2 !==""){
		hasChecked = true;
	}
	if(chkswhite3 !==""){
		hasChecked = true;
	}
	if(chkswhite4 !==""){
		hasChecked = true;
	}
	if (hasChecked == false){
		
		alert("Please select at least one sign for stock. ");
		return false;
	}
	return true;
	
});

// CUSTOM SIGN PAGE
// ------------------------------------------------------------------------------

// hide form initially
$("form#frmCustom").hide();

// sign select box
$("body.custom #signselect select").change(function() {
		var filename = $(this).val(),
			title = $(":selected", this).text();
		if (filename) {
			loadCustomSign(filename, title);
		}
	})
	.one("change", function() {
		closeMenu();
	});

// sign menu
$("body.custom #signmenu .item").css("cursor", "pointer")
	.click(function() {
		var filename = $(this).attr("id"),
			title = $("h4", this).text();
		loadCustomSign(filename, title);
	})
	.one("click", function() {
		closeMenu();
	});

// close sign menu
closeMenu = function() {
	// hide sign menu
	$("#signmenu").fadeOut("fast");
}
	
// load custom sign form
loadCustomSign = function (filename, title) {
	// fade out form
	$("form#frmCustom").fadeOut("fast", function() {	
		// load form
		$("div#load").load("custom-"+filename+".php",null,function() {
			initAfterLoad();
		});
	});
	// update title
	$("h2").text(title);
	// revert sign select box to default
	$("body.custom #signselect select").val(0);
};

// initalize page after custom sign form is loaded
initAfterLoad = function() {

	// fade in form
	$("form#frmCustom").fadeIn("fast");	
	
	// set step numbers
	$(".group").each(function(i) {
		i++;
		$("h4", this).not(":has(span.num)").prepend('<span class="num"></span> ');
		$("span.num", this).text(i+". ");
	});	

	// date picker
	$(".datepicker").datepicker();

	// inline labels
	$(':input.inlinelabel').inlineLabel();

	// label widths
	$("#message label.main").equalizer();

	// text inputs for select boxes
	$(".selecttext input")
		.hide()
		.parent().prev("select").change(function() {
			var id = $(":selected", this).attr("class") || "null";
			$(this).next(".selecttext").children("input")
				.hide()
				.filter("#"+id).show();
		});
	
	// populate now price and savings
	var nowTotal = $("#styles td.nowTotal").text(),
		savTotal = $("#styles td.savTotal").text();
	$("#message span.nowTotal").text(nowTotal);
	$("#message span.savTotal").text(savTotal);

	// calculate new savings
	$("#message input#txtPrice").keyup(function() {
		$("#message input#txtSavings").calc(
			// the equation to use for the calculation
			"origPrice - newPrice",
			// define the variables used in the equation, these can be a jQuery object
			{
				origPrice: $("#styles td.origTotal"),
				newPrice: $("#message input#txtPrice")
			},
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s;
			}
		);
	});

	// multi-item message toggle
	var apparelMessage = $("#message .row.apparel"),
		sameMessage = $("#message .row.same");
	apparelMessage.hide();
	sameMessage.hide();
	$("#message input[name='radType']").click(function(){
		if ($("input[name='radType']:checked").val() == 'apparel') {
			sameMessage.fadeOut("fast", function() {
				apparelMessage.fadeIn("fast");
			});
		}
		else {
			apparelMessage.fadeOut("fast", function() {
				sameMessage.fadeIn("fast");
			});
		}
	});	

};

// check/uncheck stores
$("body.custom button.all").click(function() {
	$("#stores :checkbox").attr("checked", "checked");
});
$("body.custom button.uncheck").click(function() {
	$("#stores :checkbox").removeAttr("checked");
});


//check/uncheck pricesigns
$("body.pricesigns button.all").click(function() {
	$("#first :checkbox").attr("checked", "checked");
});
$("body.pricesigns button.uncheck").click(function() {
	$("#first :checkbox").removeAttr("checked");
});

// preview dialog
var dialogPreview = $("#dialog-preview");
// initialize dialog
dialogPreview.dialog({
	autoOpen: false,
	width: 600,
	modal: true,
	open: function() {
		// load pdf
		var src = $("iframe", this).attr("src");
		$("iframe", this).attr("src", src);
	}
});
// 'Preview' button
//$("body.custom button.preview").click(function() {
$("button.preview").click(function() {
	dialogPreview.dialog("open");
});
// 'Cancel' button
$("button.edit", dialogPreview).click(function() {
	dialogPreview.dialog("close");
});	
// 'Update' button
$("button.add", dialogPreview).click(function() {
	dialogPreview.dialog("close");
});	

});
// end DOM ready execution


// FUNCTIONS
// ------------------------------------------------------------------------------

// return largest value from array
Array.max = function(array){
	return Math.max.apply( Math, array );
};

// capitalize word
String.prototype.capitalize = function(){
    return this.replace(/\w+/g, function(a){
        return a.charAt(0).toUpperCase() + a.substr(1).toLowerCase();
    });
};

// make question and answer same height
(function($){
	$.fn.faqAdjustHeight = function() {
		return this.each(function() {
			var thisQuestion = $(this),
				thisAnswer = thisQuestion.next(),
				questionHeight = thisQuestion.height(),
				answerHeight = thisAnswer.height();
			if (questionHeight > answerHeight) {
				thisAnswer.height(questionHeight);
				thisQuestion.height(questionHeight);
			}
			else {
				thisQuestion.height(answerHeight);
				thisAnswer.height(answerHeight);
			}
		});
	}
})(jQuery);

// inline form field label
(function($){
	$.fn.inlineLabel = function() {
		return this.each(function() {
			var label = $(this).attr('title');
			if ($(this).val() === '') {
				$(this).val(label)
					.addClass('inlinelabel');
			}
			$(this).focus(function() {
					if ($(this).val() === label) {
						$(this).val('').removeClass('inlinelabel');
					}
				})
				.blur(function() {
					if ($(this).val() === '') {
						$(this).val(label).addClass('inlinelabel');
					}
				});
		 });	
	}
})(jQuery);

// width equalizer
(function($){
	$.fn.equalizer = function() {
		var max = 0;
		this.each(function(){
			if ($(this).width() > max)
				max = $(this).width();    
		});
		return this.width(max);	
	}
})(jQuery);


function numberValidation(event) {


	var charCode = (event.which) ? event.which : event.keyCode
	
	if (charCode > 31 && (charCode < 48 || charCode > 57))
	{
		return false;
	}
	else
	{
		
		var qty = 0;
		var sizeSign='';
		var colorSign='';
		var v_page=0;
		var txtqty = $('*[name=txtQty[]]'); 
			//alert('name: '+txtqty.length);
		for (var i = 0; i < txtqty.length; i++){
			var qty = parseInt(qty) + parseInt(txtqty[i].value);
			
		}
		
		sizeSign=$("#size_sign").val();
		colorSign =$("#color_sign").val();
	
		if(sizeSign=="2.75x1.25"){
			v_page=Math.ceil((qty)/15);
		}else if(sizeSign=="5x7"){
			v_page=Math.ceil((qty)/2);
		}else if(sizeSign=="7x5"){
			v_page=Math.ceil((qty)/2);
		}else if(sizeSign=="9x2"){
			v_page=Math.ceil((qty)/4);
		}
		
		$("#updateQty").html('');
		$("#updateQty").append('<p>3.Add <strong>'+v_page+'</strong> <strong>'+colorSign+'</strong> page(s) of <strong>'+sizeSign+'</strong> to the printer and print:</p>');
		$("#dialog_qty").html('');
		$("#dialog_qty").append('<p style="text-align: center;">Add <strong>'+v_page+'</strong> <strong>'+colorSign+'</strong> page(s) of <strong>'+sizeSign+'</strong> to the printer and print:</p>');
		if(v_page>4){
			$("#dialog_qty").append('<p style="text-align: center; color:#FF3333;"><strong>One print shot only 4 page(s) to be print...</strong></p>');
		}
		return true; 
	}
}


// CART submit form 
function print_submit(){
	
	$("#dialog_print").dialog({
		bgiframe: true,
		autoOpen: false,
		width:480,
		modal: true
	});
	// open modal
	$("button.print").click(function() {
		$("#dialog_print").dialog("open");
		return false;
	}); 
	
	// click outside modal to close
	$(".ui-widget-overlay", "body:has(#dialog_print)").live("click", function() {
		$("#dialog_print").dialog("close");
		return false;
	});
	// click cancel button to close 
	$("button.cancel_print").click(function() {
		$("#dialog_print").dialog("close");
		return false;
	});
	// click print button to submit
	$("button.print_page").click(function() {
		$("#dialog_print").dialog("close");
		$('#frmCart').submit();
			return true;
		
	});
}
		

function getsubcategory(p_org_id){
	
	 var v_class = $("#selFilterCategory").val(); 
	 var v_tabid= $("#tabid").val();
	
	if(v_tabid==='weekly'){
		getsubclass(p_org_id,v_class);
	}else if(v_tabid==='special'){
		getseventsubclass(p_org_id,v_class);
	}
}
//for weekly sign
function getsubclass(org_id,p_class){
	v_url =jQuery.url.attr("host");
	$.ajax( {
	    type : 'post',
	    url : 'http://'+ v_url + '/index.php/sign_controller/filtersubclass',
	    data : '&v_class='+p_class,
	    cache : false,
	    async : true,
	    success : function(html) {
	      $("#filtersubclass").empty();
	      $("#filtersubclass").append(html);
	      }
	});
}
//for specialevents signs
function getseventsubclass(org_id,p_class){
	v_url =jQuery.url.attr("host");
	$.ajax( {
	    type : 'post',
	    url : 'http://'+ v_url + '/index.php/events_controller/filtersubclass',
	    data : '&v_class='+p_class,
	    cache : false,
	    async : true,
	    success : function(html) {
	      $("#filtersubclass").empty();
	      $("#filtersubclass").append(html);
	      }
	}); 
}

function getfiltersignsize(){
	
	
		 var v_subclass = $("#selFilterCategorySub").val(); 
		 var v_tabid= $("#tabid").val();
		
		if(v_tabid==='weekly'){
			getfiltersize(v_subclass);
		}else if(v_tabid==='special'){
			geteventsfiltersize(v_subclass);
		}
}
function getfiltersize(v_subclass){
	v_url = jQuery.url.attr("host");
	$.ajax({
		type:'post',
		url:'http://'+v_url+'/index.php/sign_controller/filterSignSize',
		data : '&v_subclass='+v_subclass,
		cache:false,
		async:true,
		success:function(html) {
		$("#filtersize").empty();
		$("#filtersize").append(html);
		}				

	});
	
}

function geteventsfiltersize(v_subclass){
	v_url = jQuery.url.attr("host");
	$.ajax({
		type:'post',
		url:'http://'+v_url+'/index.php/sign_controller/filterSignSize',
		data : '&v_subclass='+v_subclass,
		cache:false,
		async:true,
		success:function(html) {
		$("#filtersize").empty();
		$("#filtersize").append(html);
		}				

	});
	
}