// JavaScript Document


var lib = Class.create();

lib.prototype = {
		initialize : function(path)
		{
			this.path = path;
		},
		
		next : function()
		{
			new Ajax.Request(this.path+'wonglokat/about_next',
					 	{
									method : 'post',
									onSuccess : function(httpobj)
									{
										$('about_right').innerHTML = httpobj.responseText;
									}
								}
								);	
		},
		prev : function()
		{
			new Ajax.Request(this.path+'wonglokat/about_prev',
								{
									method : 'post',
									onSuccess : function(httpobj)
									{
										$('about_right').innerHTML = httpobj.responseText;
									}
								}
								);
		},
		setamount : function()
		{
			var amount = (!isNaN(parseInt($('amount').value))) ? parseInt($('amount').value) : 0;
			var carriage = parseInt($('carriage').value);
			var price = parseInt($('price').value);
			var tanka;
			if(amount > 1 )
			{
				tanka = price;
				$('carriage_disp').innerHTML = '<span class="red">送料無料になります</span>';
			}
			else
			{
				tanka = price + carriage;
				$('carriage_disp').innerHTML = '450円';
			}
			total_price = tanka*amount;
			$('total_amount').innerHTML = total_price+'円';
			$('total_amount_hidden').setAttribute('value',total_price);
		},
		convert_number : function(id)
		{
	
		  work='';
		  for (lp=0;lp<id.value.length;lp++) {
			unicode=id.value.charCodeAt(lp);
			if ((0xff0f<unicode) && (unicode<0xff1a)) {
			  work+=String.fromCharCode(unicode-0xfee0);
			} else if ((0xff20<unicode) && (unicode<0xff3b)) {
			  work+=String.fromCharCode(unicode-0xfee0);
			} else if ((0xff40<unicode) && (unicode<0xff5b)) {
			  work+=String.fromCharCode(unicode-0xfee0);
			} else {
			  work+=String.fromCharCode(unicode);
			}
		  }
		  id.value=work;
		},
		getlocation : function(method)
		{
			locate = window.location;
			alert(locate+method);
/*			if(locate.indexOf("www") > -1)
			{
				return 'http://wonglokat.jp/wonglokat'+method;
			}
			else
			{
				return 'http://www.wonglokat.jp/wonglokat'+method;
			}*/
		}
}

function writeflash()
{
	text = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="500" id="wonglokat_2" align="middle"><param name="allowScriptAccess" value="always" /><param name="movie" value="http://www.wonglokat.jp/img/wonglokat/wonglokat_2.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="http://www.wonglokat.jp/img/wonglokat/wonglokat_2.swf" quality="high" bgcolor="#ffffff" width="900" height="500" name="wonglokat_2" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	document.write(text);
}
