var Guide = Class.create();

Guide.prototype = {
		initialize : function(path)
		{
			this.guide_to_path = path;
			this.guide_count = 1;
		},
		next : function()
		{
			$('load').appendChild(Cart.loadimage);
			this.guide_count = this.guide_count+1;
			//ＩＥ用キャッシュ対策
			if(navigator.userAgent.indexOf('MSIE') != -1)
			{
				url = this.guide_to_path+'guide/ajax_page_next_prev/'+this.guide_count+'/'+Math.random()*1000;
			}
			else
			{
				url = this.guide_to_path+'guide/ajax_page_next_prev/'+this.guide_count;
			}
			new Ajax.Request(url,
							 {
								 method : 'get',
								 onSuccess : function(httpobj)
								 {
								 	$('load').removeChild(Cart.loadimage)
									 document.getElementById('guide_state').style.backgroundImage = 'url(img/guide/guide_'+Guide.guide_count+'.jpg)';
									 document.getElementById('guide_text').innerHTML = httpobj.responseText;
								 },
								 onFailure : function()
								 {
									 document.getElementById('guide_text').innerHTML = 'データ通信に失敗しました。';
								 }
							 });
		},
		prev : function()
		{
			$('load').appendChild(Cart.loadimage);
			this.guide_count = this.guide_count-1;
			if(navigator.userAgent.indexOf('MSIE') != -1)
			{
				url = this.guide_to_path+'guide/ajax_page_next_prev/'+this.guide_count+'/'+Math.random()*1000;
			}
			else
			{
				url = this.guide_to_path+'guide/ajax_page_next_prev/'+this.guide_count;
			}
			new Ajax.Request(url,
								{
								 method : 'get',
								 onSuccess : function(httpobj)
								 {
								 	$('load').removeChild(Cart.loadimage);
									 document.getElementById('guide_state').style.backgroundImage = 'url(img/guide/guide_'+Guide.guide_count+'.jpg)';
									 document.getElementById('guide_text').innerHTML = httpobj.responseText;
								 },
								 onFailure : function()
								 {
									 document.getElementById('guide_text').innerHTML = 'データ通信に失敗しました。';
								 }
							 });
		},
		//メールマガジンの購読申し込み
		regist_mag : function(member_id)
		{
		if(typeof(member_id) == 'number')
		{
			path = this.guide_to_path+'guide/regist_mag/'+member_id;
		}
		else
		{
			path = this.guide_to_path+'guide/regist_mag/0';
		}
			new Ajax.Request(path,
							{
								method : 'post',
								onSuccess : function(httpobj)
								{
									Cart.dialogshow(httpobj.responseText);
								},
								onFailure : function()
								{
									alert('データ通信に失敗しました。');
								}
							});

		},
		order_mag : function(member_id)
		{
			new Ajax.Updater($('modal'),this.guide_to_path+'guide/order_mag/'+member_id);
		}

}


