
function language_set(language) {
	
	if (language == "debug") {
		
		replace_TXT(language);
		return;
	}
	
	language_load(language);
		
}

function language_load(language) {
	
	if (language == "debug") {
		
		replace_TXT(language);
		return;
	}
	
	if (language != 0) {
		var xml_url = "xml/get_language.php?language="+language
	}
	else {
		var xml_url = 	"xml/get_language.php";
	}
	
	$.ajax({
		type: "GET",
		url: xml_url,
		// data: post_data,
		dataType: "xml",
		error: function (XMLHttpRequest, textStatus, errorThrown) {

			alert("Error loading -> language "+language);
			return;
		},
		success: function(xml, textStatus) {
			
			var language_text = "English";
			
			if (language == "en") {
				language = "gb";
			}

			$('#topbar_language p').css('background','#b19e80 url(../img/icons/flags/'+language+'.png) 6px 5px no-repeat');
			
			$("language_data", xml).children().each(function() {
			
				var tag_name = this.tagName;
				var txt = $(this).text();
				
				$.language_data[tag_name] = txt;
			});
			
			$('#language_text').html($.language_data['TXT_LANG_FULL']);

			replace_TXT(language);
		}
	});
}


function replace_TXT(lang) {
	
	// var target = top.document.getElementById(frame_name).contentWindow.document.getElementsByTagName("*");
	var target = top.document.getElementsByTagName("*");
	
	$.each(target, function(i, item)
	{
		if (typeof($(item).attr("id")) != "undefined") {
			
			if( $(item).attr("id").substr(0,3) == "TXT") {
				
				if (this.tagName == "INPUT") {
						
					$(item).attr("value",$.language_data[$(item).attr("id")]);
	
				} else {
					
					// if ($.session_data['language'] == 'debug') {
					if (lang == 'debug') {
						var tmp = $(item).attr("id");
						
						$(item).text(tmp);
					}
					else {
						
						if (typeof($.language_data[$(item).attr("id")]) != "undefined") {
						
							$(item).html(parent.$.language_data[$(item).attr("id")]);
						}
						else {
							$(item).html($(item).attr("id"));
						}
					}
				}
			}
		}
	});
}

function print_error_bar(message) {
	
	$('#error_bar').html("<p>"+message+"</p>");
	$('#error_bar').show();
}


function remove_line(line_id) {
	
	$.result_data = new Array();
	
	$.get("xml/get.php?id=remove_product&session="+$.session_data['session_id']+"&line_id="+line_id, function(xmldata){

		$("result", xmldata).children().each(function() {
			
			var tag_name = this.tagName;
			var txt = $(this).text();
			
			$.result_data[tag_name] = txt;
			
		});	
		
		if ($.result_data["affected_rows"] != 1) {
			
			alert("Failed to remove product");
			return;
		}
		
		print_cart_lines();
	});
}

function print_cart_lines() {
	
	$.post("xml/get.php?id=cart&session="+$.session_data['session_id'], function(xmldata){
		
		xdata = new Array();
		var cnt = 0;
		var debug_str = '';
		
		$("row", xmldata).children().each(function() {
			
			var tag_name = this.tagName;
			var txt = $(this).text();
			
			if (tag_name == 'orderline_id') {
				
				cnt++;
			}
			
			if (typeof(xdata[cnt]) == 'undefined') {

				xdata[cnt] = new Array();
			}
			
			xdata[cnt][tag_name] = new String(txt);
		});
		
		var remove_line = '';
		var cart_remove_line = '';
		var str = '';
		var total = new Number(0);
		
		if (cnt == 0) {
			
			var total_html = (total.toFixed(2))+'&nbsp;'+currency;
			
			$('#cart_lines').html('<li class="cart_item"><span class="cart_item_name">No products in cart.</span></li>');
			$('#topbar_cart_lines').html('<li class="cart_item"><span class="cart_item_name">No products in cart.</span></li>');
			$('#cart_total').html('Total : '+total_html);
			$('#topbar_cart_total').html('Total : '+total_html);
			
			$('#cart_table').html('<tr class="even"><td class="product_name" colspan="5">No products in cart.</td></tr>');
			$('#cart_table_total').html('Total : '+total_html);
			$('#cart_table_subtotal').html('&nbsp;'+total_html);
			$('#cart_table_shipprice').html('&nbsp;'+total_html);
			
			$('#side_bar_checkout').hide();
			$('#topbar_checkout').hide();

			return;
		}
		else {
			$('#side_bar_checkout').show();
			$('#topbar_checkout').show();
		}

		$('#cart_lines').html('');
		$('#topbar_cart_lines').html('');
		$('#cart_table').html('');
		$('#order_review').html('');
		cnt=0;
		var odd_even = '';
		var amount_seeds,quantity,display_quantity;
		var amount_items = new Number(0);
		
		for (x in xdata) {
			// remove_line = '<span class="action_remove"><a href="javascript:remove_line('+xdata[x]['orderline_id']+');">remove</a></span>';
			
			cnt++;
			amount_seeds = 10 * (new Number(xdata[x]['amount']));
			amount_items = amount_items + new Number(xdata[x]['amount']);
			remove_line = '<span class="action_remove" l_id="'+xdata[x]['orderline_id']+'"></span>';
			cart_remove_line = '<a href="javascript:remove_line('+xdata[x]['orderline_id']+');" class="remove_item" name="quantity_package">remove product</a>';
			str = new String(xdata[x]['description_line']);
			total += new Number(xdata[x]['lineprice']);
			// quantity = '<td class="product_quantity">Quantity <input type="text" value="'+xdata[x]['amount']+'" /></td>';
			quantity = '<td class="product_quantity">Quantity <select class="cart_table_quantity" name="quantity" p_id="'+xdata[x]['product_id']+'">';
			display_quantity = '<td class="product_quantity">Quantity '+xdata[x]['amount']+'</td>';
			
			var selected_txt = '';
			
			for (var i=1;i<10;i++) {
				
				selected_txt = '';
				
				if (i == ( new Number(xdata[x]['amount']))) {
					
					selected_txt = 'selected';
				}
				
				
				quantity += '<option value="'+i+'" '+selected_txt+'>'+i+'</option>';
			}
			
			quantity += '</select></td>';

			// my_debug('str='+str.match(/free/gi));
			
			if (str.match(/free/gi) != null){ // && str.match(/seed/gi)) {
				
				remove_line = '&nbsp;';
				cart_remove_line = '&nbsp;';
			}
			
			if (xdata[x]['lineprice'] == '0.00') {
				
				amount_seeds = 20;
				quantity = '<td class="product_quantity">&nbsp;</td>';
			}
			
			//alert('curr_rate='+currency_rate);
			
			// .toFixed(2))+'&nbsp;'+currency
			var line_price = new Number(xdata[x]['lineprice']*currency_rate);
			var line_price_html = (line_price.toFixed(2))+'&nbsp;'+currency;
			
			//alert('line_price='+line_price);
			
               if (xdata[x]['lineprice'] == '0.00') {
			  
         	          $('#cart_lines').append(
     				
     				'<li class="cart_item"><span class="cart_item_quantity">'+xdata[x]['amount']+'</span><span class="cart_item_name_and_price">'
     				+'<span class="cart_item_name">'+xdata[x]['description_line']+'</span>'
     				+'<span class="cart_item_price"><span txt="TXT_90">Price</span>: '+line_price_html+'</span>'
     				+'<div class="clr"></div></span><span class="actions">'+remove_line+'</span>'
     				+'<div class="clr"></div></li>'
     			);
     			
     			$('#topbar_cart_lines').append(
     				
     				'<li class="cart_item"><span class="cart_item_quantity">'+xdata[x]['amount']+'</span><span class="cart_item_name_and_price">'
     				+'<span class="cart_item_name">'+xdata[x]['description_line']+'</span>'
     				+'<span class="cart_item_price"><span txt="TXT_90">Price</span>: '+line_price_html+'</span>'
     				+'<div class="clr"></div></span><span class="actions">'+remove_line+'</span>'
     				+'<div class="clr"></div></li>'
     			);
                 
                 
                			odd_even = 'odd';
			
				if ((cnt%2) == 0) {
					
					odd_even = 'even';
				}
				
				$('#cart_table').append(
					'<tr class="'+odd_even+'">'
					+'<td class="product_name"><span class="free_seeds_as_cart_line">'+xdata[x]['description_line']+'</span></td>'
			          +'<td class="product_amount">'+amount_seeds+'  <span txt="TXT_126">Seeds</span></td>'
			          +quantity
			          // +'<td class="product_quantity">Quantity <input type="text" value="'+xdata[x]['amount']+'" /></td>'
			          +'<td class="product_price"><span txt="TXT_90">Price</span> : '+line_price_html+'</td>'
			          +'<td class="product_action">'+cart_remove_line+'</td>'
					+'</tr>'
				); 
				
				$('#order_review').append(
					'<tr class="'+odd_even+'">'
					
					+'<td class="product_name"><span class="free_seeds_as_cart_line">'+xdata[x]['description_line']+'</span></td>'
			          +'<td class="product_amount">'+amount_seeds+' <span txt="TXT_126">Seeds</span></td>'
			          +display_quantity
			          // +'<td class="product_quantity">Quantity <input type="text" value="'+xdata[x]['amount']+'" /></td>'
			          +'<td class="product_price"><span class="float_text_to_right">'+line_price_html+'</span></td>'
			          +'</tr>'
				);     

			}else{
			  
	               $('#cart_lines').append(
					
					'<li class="cart_item"><span class="cart_item_quantity">'+xdata[x]['amount']+'</span><span class="cart_item_name_and_price">'
					+'<a class="shopping_cart_product_link" href="/'+xdata[x]['description_line']+'-marijuana-seeds.php"><span class="cart_item_name">'+xdata[x]['description_line']+'</span></a>'
					+'<span class="cart_item_price"><span txt="TXT_90">Price</span>: '+line_price_html+'</span>'
					+'<div class="clr"></div></span><span class="actions">'+remove_line+'</span>'
					+'<div class="clr"></div></li>'
				);
				
				$('#topbar_cart_lines').append(
					
					'<li class="cart_item"><span class="cart_item_quantity">'+xdata[x]['amount']+'</span><span class="cart_item_name_and_price">'
					+'<a class="shopping_cart_product_link" href="/'+xdata[x]['description_line']+'-marijuana-seeds.php"><span class="cart_item_name">'+xdata[x]['description_line']+'</span></a>'
					+'<span class="cart_item_price"><span txt="TXT_90">Price</span>: '+line_price_html+'</span>'
					+'<div class="clr"></div></span><span class="actions">'+remove_line+'</span>'
					+'<div class="clr"></div></li>'
				); 
	                
	                
	               odd_even = 'odd';
				
				if ((cnt%2) == 0) {
					
					odd_even = 'even';
				}
				
				 
				
				$('#cart_table').append(
					'<tr class="'+odd_even+'">'
					+'<td class="product_name"><a class="shopping_cart_product_link" href="/'+xdata[x]['description_line']+'-marijuana-seeds.php">'+xdata[x]['description_line']+'</a></td>'
			          +'<td class="product_amount">'+amount_seeds+' <span txt="TXT_126">Seeds</span></td>'
			          +quantity
			          // +'<td class="product_quantity">Quantity <input type="text" value="'+xdata[x]['amount']+'" /></td>'
			          +'<td class="product_price"><span txt="TXT_90">Price</span> : '+line_price_html+'</td>'
			          +'<td class="product_action">'+cart_remove_line+'</td>'
					+'</tr>'
				);
                 	
                 	$('#order_review').append(
					'<tr class="'+odd_even+'">'
					
					+'<td class="product_name"><a class="shopping_cart_product_link" href="/'+xdata[x]['description_line']+'-marijuana-seeds.php">'+xdata[x]['description_line']+'</a></td>'
			          +'<td class="product_amount">'+amount_seeds+' <span txt="TXT_126">Seeds</span></td>'
			          +display_quantity
			          // +'<td class="product_quantity">Quantity <input type="text" value="'+xdata[x]['amount']+'" /></td>'
			          +'<td class="product_price"><span class="float_text_to_right">'+line_price_html+'</span></td>'
			          +'</tr>'
				);
                 	
			}
		}
		// set cart_total
		ordered_items = amount_items;
		sub_total = total;
		$.order_total = total;
		
		var total_price = new Number(total*currency_rate);
		var total_price_html = (total_price.toFixed(2))+'&nbsp;'+currency;
		
		$('#cart_total').html('Total : '+total_price_html);
		$('#topbar_cart_total').html('Total : '+total_price_html);
		$('#cart_table_subtotal').html('&nbsp;'+total_price_html);
		
		var ship_price = new Number((14+amount_items)*currency_rate);
		var ship_price_html = (ship_price.toFixed(2))+'&nbsp;'+currency;
		$('#cart_table_items').html('&nbsp;(priority mail)');
		$('#cart_table_shipprice').html('&nbsp;'+ship_price_html);
		total = total_price + ship_price;
		
		$.order_total = total;
		
		var total_price_html = (total.toFixed(2))+'&nbsp;'+currency;
		
		$('#cart_table_total').html('Total : '+total_price_html);
		
		$('.action_remove').click(function() {
		
			var line = $(this).attr('l_id');
			
			top.remove_line(line);
		});
		
		$('.cart_table_quantity').change(function() {
			
			add_product($(this).attr('p_id'),$(this).val(),"set");
		});
		
		setTimeout(function() {
		
			$('#topbar_shoppingcart_block').fadeOut(200);
		
		}, 4000);
		
		if ($.order_total > 200) {
			
			$('#o_phone_row').show();
		}
		
		
	});
}

function add_product(product_id,amount,action) {
	
	$.result_data = new Array();
	
	$.get("xml/get.php?id=add_product&session="+$.session_data['session_id']+"&product_id="+product_id+"&amount="+amount+'&action='+action, function(xmldata){

		$("result", xmldata).children().each(function() {
			
			var tag_name = this.tagName;
			var txt = $(this).text();
			
			$.result_data[tag_name] = txt;
			
		});	
		
		if ($.result_data["affected_rows"] != 1) {
			
			alert("Failed to add product");
			return;
		}
		
		// http://www.amsterdammarijuanaseeds.com/shoppingcart.php
		// top.window.location = "cart.php";
		
		top.window.location = "http://www.amsterdammarijuanaseeds.com/shoppingcart.php";
		
		//$('#topbar_shoppingcart_block').fadeIn(200);
		
		//print_cart_lines();
		
	});
	
	
}

function check_order_status() {
	
	$.ajax({
		type: "GET",
		url: "xml/get.php?id=order&session="+$.session_data['session_id'],
		dataType: "xml",
		error: function (XMLHttpRequest, textStatus, errorThrown) {
			// error message
			return;
		},
		success: function(xml, textStatus) {
			
			var o_status = new Number($("row", xml).find("status").text());
			var o_shipprice = new Number($("row", xml).find("shipprice").text());
	
			if (ordered_items > 0) {
				
				if (o_shipprice == 16.00) {
					
					o_shipprice = 14.00;
				}
				else {
					ordered_items = 0;
				}
				
				var ship_price = new Number((o_shipprice+ordered_items)*currency_rate);
				var ship_price_html = (ship_price.toFixed(2))+'&nbsp;'+currency;
				
				var mail_type_text = 'Priority mail';
				
				if ((o_shipprice * 100) > 2000) {
					
					var mail_type_text = 'Registered with track and trace';
				
				}
				
				$('#cart_table_items').html('&nbsp;('+mail_type_text+')');
				$('#review_table_items').html('&nbsp;('+mail_type_text+')');
				
				$('#cart_table_shipprice').html('&nbsp;'+ship_price_html);
				$('#review_table_shipprice').html('&nbsp;'+ship_price_html);
				
				var subtotal_price = new Number(sub_total*currency_rate);
				//var subtotal_price_html = (subtotal_price.toFixed(2))+'&nbsp;'+currency;
				//$('#cart_table_subtotal').html('&nbsp;'+subtotal_price_html);
				var totalPrice = subtotal_price + ship_price;
				var total_price_html = (totalPrice.toFixed(2))+'&nbsp;'+currency;
				$('#cart_table_total').html('Total : '+total_price_html);
			}
	
			
		}
	});
	
}

function form_error_handler(my_form, required, email, errornotice, emptyerror, emailerror) {
	
	$("#"+my_form).submit(function(){
		
		//Validate required fields
		for (i=0;i<required.length;i++) {
			var input = $('#'+required[i]);
			if ((input.val() == "") || (input.val() == emptyerror)) {
				input.addClass("needsfilled");
				input.val(emptyerror);
				errornotice.fadeIn(750);
			} else {
				input.removeClass("needsfilled");
			}
		}
		if (email != 0) {
			// Validate the e-mail.
			if (!/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email.val())) {
				email.addClass("needsfilled");
				email.val(emailerror);
			}
		}	
		//if any inputs on the page have the class 'needsfilled' the form will not submit
		if ($(":input").hasClass("needsfilled")) {
			
			return false;
		} else {
			$('#'+my_form).trigger('form_ok');
			errornotice.hide();
			return false;
		}
	});
	
	// Clears any fields in the form when the user clicks on them
	$(":input").focus(function(){
		if ($(this).hasClass("needsfilled") ) {
			$(this).val("");
			$(this).removeClass("needsfilled");
		}
	});
}




function goToByScroll(id) {

	$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}

$(document).ready(function() { 
 	
 	/*
 	$('.currency_3char').click(function() {
		
		// alert('click'+$(this).attr('curr'));
		
		$('#currency_container').val($(this).attr('curr'));
	});	
 	*/
 	
 // TOPBAR SHOPPINGCART

	showState = 0;
	 
	$('#topbar_shoppingcart a.shoppingcart_button').mouseenter(function() {
	
		$('#topbar_shoppingcart_block').fadeIn(200);
	
		showState = showState + 1;
	
		//alert(showState);
	
	});
          
	$('#topbar_shoppingcart_block').mouseenter(function() {
	
		showState = showState + 1;
	
		//alert(showState);
	
	});

          
	$('#topbar_shoppingcart a.shoppingcart_button').mouseleave(function() {
	
		setTimeout(function() {
	
			showState = showState - 1;
	
			if(showState == 0 ){
				setTimeout(function() {
	
					if(showState == 0 ){
	
						$('#topbar_shoppingcart_block').fadeOut(200);
					}
				}, 100);
			}
	
		}, 200);
		//alert(showState);
	});
	
	$('#topbar_shoppingcart_block').mouseleave(function() {
	
		showState = showState - 1;
	
		//alert(showState);
	
		if(showState == 0 ){
	
			setTimeout(function() {
	
				if(showState == 0 ){
	
					$('#topbar_shoppingcart_block').fadeOut(200);
				}
			}, 100);
		}
	});
	   
	// TOPBAR LANGUAGE
	
	showStatea = 0;
	
	$('#topbar_language p').mouseenter(function() {
	
		$('#topbar_language_block').fadeIn(200);
	
		showStatea = showStatea + 1;
	
		//alert(showState);
	
	});
	
	$('#topbar_language_block').mouseenter(function() {
	
		showStatea = showStatea + 1;
	
		//alert(showState);
	});
	
	
	$('#topbar_language p').mouseleave(function() {
	
		setTimeout(function() {
	
			showStatea = showStatea - 1;
	
			if(showStatea == 0 ){
				setTimeout(function() {
	
					if(showStatea == 0 ){
	
						$('#topbar_language_block').fadeOut(200);
					}
				}, 100);
			}
	
		}, 200);
		//alert(showState);
	});
	
	$('#topbar_language_block').mouseleave(function() {
	
		showStatea = showStatea - 1;
	
		//alert(showState);
	
		if(showStatea == 0 ){
	
			setTimeout(function() {
	
				if(showStatea == 0 ){
	
					$('#topbar_language_block').fadeOut(200);
				}
			}, 100);
		}
	});

	// TOPBAR CURRENCY

	showStateb = 0;
	
	$('#topbar_currency p').mouseenter(function() {
	
		$('#topbar_currency_block').fadeIn(200);
	
		showStateb = showStateb + 1;
	
		//alert(showState);
	
	});
	
	$('#topbar_currency_block').mouseenter(function() {
	
		showStateb = showStateb + 1;
	
		//alert(showState);
	
	});
	
	
	$('#topbar_currency p').mouseleave(function() {
	
		setTimeout(function() {
	
			showStateb = showStateb - 1;
	
			if(showStateb == 0 ){
				setTimeout(function() {
	
					if(showStateb == 0 ){
	
						$('#topbar_currency_block').fadeOut(200);
					}
				}, 100);
			}
	
		}, 200);
		//alert(showState);
	});
	
	$('#topbar_currency_block').mouseleave(function() {
	
		showStateb = showStateb - 1;
	
		//alert(showState);
	
		if(showStateb == 0 ){
	
			setTimeout(function() {
	
				if(showStateb == 0 ){
	
					$('#topbar_currency_block').fadeOut(200);
				}
			}, 100);
		}
	});

	/* Homepage Animation */
         
	$('.sevent').css({opacity: 0.0}, 500);
	
	setTimeout(function() {
		$('.first').animate({right: '460px'}, 1000);
		$('.second').delay(400).animate({top: '-310px'}, 1000);
		$('.third').delay(600).animate({top: '-310px'}, 1000);
		$('.fourth').delay(800).animate({top: '-310px'}, 1000);
		$('.fifth').delay(2600).animate({left: '-215px'}, 1000);
		$('.sixt').delay(2900).animate({left: '-215px'}, 1000);
		$('.sevent').delay(3900).animate({opacity: 0.5}, 200);
		$('.sevent').delay(200).animate({opacity: 0.0}, 200);
	}, 1500);
	
	$('.strain_item.block').mouseenter(function() {
	
		$(this).find('.strain_item_txt').animate({marginLeft: '0'}, 200);
	
		//alert(showState);
	});

	$('.strain_item.block').mouseleave(function() {
	
		$(this).find('.strain_item_txt').animate({marginLeft: '160px'}, 200);
	
		//alert(showState);
	});
	
	$('input.star').rating();
	
	$('#review').keyup(function() {

		var len = this.value.length;
	
		if (len >= 500) {
	
			this.value = this.value.substring(0, 500);
	
		}
	
		$('#remainingCharacters').text(500 - len);
	
	});
	
	
	$('#side_bar_checkout').click(function() {
		
		top.window.location = "shoppingcart.php";
	});
	
	$('#topbar_checkout').click(function() {
		
		top.window.location = "shoppingcart.php";
	});
	
	
	
	
	$('#side_bar_checkout').hide();
	$('#topbar_checkout').hide();
	
	
	$('#page').mouseenter(function() {
	
		$('#topbar_shoppingcart_block').fadeOut(200);
	});
	
	$('#search_form').click(function() {
		
		top.window.location = "search.php";
		
		return false;
	});
	
	$('#contact_form').submit(function() {
		
		$.get("xml/post.php?file_id=1&session="+$.session_data['session_id']+"&"+$(this).serialize(), function(xmldata){
			
			$.result_data = new Array();
			
			$("result", xmldata).children().each(function() {
			
				var tag_name = this.tagName;
				var txt = $(this).text();
				
				$.result_data[tag_name] = txt;
				
			});
			
			if (!$.result_data["inserted_id"]) {
				
				// $(this).find("description");
				// debug_object($(this).find("description").tagName);
				alert($("error", xmldata).find("description").text());
				return;
			}
			
			alert('Contact form received');
			
		});
		// alert($(this).serialize());
		return false;
	});
/*	
	$('#order_form_step_one').bind('form_ok',function() {
		
		$.get("xml/post.php?file_id=2&session="+$.session_data['session_id']+"&"+$(this).serialize(), function(xmldata){
			
			$.result_data = new Array();
			
			$("result", xmldata).children().each(function() {
			
				var tag_name = this.tagName;
				var txt = $(this).text();
				
				$.result_data[tag_name] = txt;
				
			});
			
			if ($.result_data["affected_rows"] == 0) {
				
				// $(this).find("description");
				// debug_object($(this).find("description").tagName);
				// alert('Data already recieved.');
				top.window.location = "checkoutcheck.php";
				return false;
			}
			
			if ($.result_data["affected_rows"] == 1) {
				
				// $(this).find("description");
				// debug_object($(this).find("description").tagName);
				// alert('Data updated.');
				top.window.location = "checkoutcheck.php";
				return false;
			}
			
			if (!$.result_data["inserted_id"]) {
				
				// $(this).find("description");
				// debug_object($(this).find("description").tagName);
				alert($("error", xmldata).find("description").text());
				// top.window.location = "checkoutcheck.php";
				return false;
			}
			
			
			
			// alert('Checkout form received');
			top.window.location = "checkoutcheck.php";
			
			
		});
		// alert($(this).serialize());
		return false;
	});
*/	
	
	
});

/** RATING 

$(function(){ // wait for document to load
	
	$('input.star').rating();
});

*/

/** CHARACTER COUNTER JAVASCRIPT
$(document).ready(function() {

	$('#review').keyup(function() {

		var len = this.value.length;
	
		if (len >= 500) {
	
			this.value = this.value.substring(0, 500);
	
		}
	
		$('#remainingCharacters').text(500 - len);
	
	});

});
**/

