var SBM_URL;
var SBM_TITLE;

function ssearch_genre(form_name, shopid, parentname, pgenreid, genreid, sevalue, sortby, pricefrom, priceto){
	//alert(document.detail.se.value);	
	//return false;
	window.document.forms[form_name].action="/"+shopid+"/"+parentname+"-"+pgenreid+"/cat-"+genreid+"-10-"+(Url.encode(document.detail.se.value)).replace(/%/g,"bb")+"-"+sortby+"-"+pricefrom+"-"+priceto+"-1.html";
	window.document.forms[form_name].submit();
}

function sgopage_new(form_name,elementname,elementvalue,shopid, parentname, pgenreid, genreid,sortby,pricefrom,priceto,se){
     // window.document.forms[form_name].elements[elementname].value = elementvalue;
	 //alert(parentname);
	  window.document.forms[form_name].action="/"+shopid+"/"+parentname+"-"+pgenreid+"/cat-"+genreid+"-"+elementvalue+"-"+se+"-"+sortby+"-"+pricefrom+"-"+priceto+"-1.html";
      window.document.forms[form_name].submit();
}


function sgopage_newRanking(form_name,elementname,elementvalue,shopid, parentname, pgenreid, genreid,perpage,pricefrom,priceto,se){	
	  window.document.forms[form_name].action="/"+shopid+"/"+parentname+"-"+pgenreid+"/cat-"+genreid+"-"+perpage+"-"+se+"-"+elementvalue+"-"+pricefrom+"-"+priceto+"-1.html";
	  
      window.document.forms[form_name].submit();
}




function search_genre(form_name, pgenreid, parentname, genreid, sevalue, shopid, sortby, pricefrom, priceto){	
	//alert(document.detail.se.value);	
	//return false;
	window.document.forms[form_name].action="/"+parentname+"-"+pgenreid+"/cat-"+genreid+"-"+shopid+"-10-"+(Url.encode(document.detail.se.value)).replace(/%/g,"bb")+"-"+sortby+"-"+pricefrom+"-"+priceto+"-1.html";
	window.document.forms[form_name].submit();
}

function gopage_new(form_name,elementname,elementvalue,pgenreid,genreid,parentname,sortby,shopid,pricefrom,priceto,se){
     // window.document.forms[form_name].elements[elementname].value = elementvalue;
	 //alert(parentname);
	  window.document.forms[form_name].action="/"+parentname+"-"+pgenreid+"/cat-"+genreid+"-"+shopid+"-"+elementvalue+"-"+se+"-"+sortby+"-"+pricefrom+"-"+priceto+"-1.html";
      window.document.forms[form_name].submit();
}


function gopage_newRanking(form_name,elementname,elementvalue,pgenreid,genreid,parentname,perpage,shopid,pricefrom,priceto,se){	
	  window.document.forms[form_name].action="/"+parentname+"-"+pgenreid+"/cat-"+genreid+"-"+shopid+"-"+perpage+"-"+se+"-"+elementvalue+"-"+pricefrom+"-"+priceto+"-1.html";
	  
      window.document.forms[form_name].submit();
}

function gopage_new_del(form_name,elementname,elementvalue,elementcheckbox){
	//alert(form_name+" - "+elementname+" - "+elementvalue);
	var obj =  document.getElementsByName(elementcheckbox); //@ȡx򔵽M
	var objLen= obj.length; //@ȡEL 
	var objYN; //Ƿx 
	var i; 
	objYN=false; 
	for (i = 0;i< objLen;i++){ 
		if (obj [i].checked==true) { 
		objYN= true; 
		break; 
		} 
	}
	if(objYN == false){
		alert('Please check an item from the list.');
		return false;
	}
	if(confirm('Do you want to delete it?')){
      window.document.forms[form_name].elements[elementname].value = elementvalue;
      window.document.forms[form_name].submit();
	}
}
function gopage_new_mod(form_name,elementname,elementvalue,elementcheckbox){
	//alert(form_name+" - "+elementname+" - "+elementvalue);
	var obj =  document.getElementsByName(elementcheckbox); //@ȡx򔵽M
	var objLen= obj.length; //@ȡEL 
	var objYN; //Ƿx 
	var i; 
	objYN=false; 
	for (i = 0;i< objLen;i++){
		if (obj [i].checked==true) { 
		objYN= true; 
		break; 
		} 
	}
	if(objYN == false){
		alert('Please check an item from the list.');
		return false;
	}
    window.document.forms[form_name].elements[elementname].value = elementvalue;
    window.document.forms[form_name].submit();
}

function popupWin(w,h,target,page)
{
   //get the width and height of the window
	var wide = w;
	var high = h;
	
	//this gets the total available width and height of the users screen
	screen_height = window.screen.availHeight;
	screen_width = window.screen.availWidth; 

	//this gets the left and top point by saying total width of the screen divided by 2 (center), minus the width of your window divided by 2, which make its center point the middle of the screen. Same for the top
	left_point = parseInt(screen_width/2)-(wide/2); 
	top_point = parseInt(screen_height/2)-(high/2)-20; 

	//just doing a simple popup window here, but plugging your info into it, and setting the top and left corners to be our calculated points that will center your window.
	win = window.open(page, target, 'width='+wide+',height='+high+',left='+left_point+',top='+top_point+',toolbar=no,location=no,scrollbars=1,status=no,resizable=no,fullscreen=no'); 
	//make sure your window is in the front 
	win.focus(); 
}


/* Write sbms
----------------------------------------------------------------------- */
function write_sbms( func ) {
	var sbms = {
		hatena    : 'ϤƤʥ֥åޡ',
		livedoor  : 'livedoorå'  ,
		yahoo     : 'Yahoo!֥åޡ',
		delicious : 'del.icio.us'       ,
		pookmark  : 'POOKMARK Airlines' ,
		google    : 'Google֥åޡ',
		nifty     : '@niftyåצ'
	};

	DW( '<ul>\n' );
	for( var id in sbms ) {
		var name = 'js-sbm-' + id;
		var text = sbms[id] + 'ɲ';
		DW( '<li>' );
		DWAJS( name,
			' title="' + text + '" onclick="return add_sbm(\'' + id + '\');"' );
		DW( '<img src="/images/sbm/' + id + '.gif" alt="' + text + '" />' );
		DW( '</a></li>\n' );
	}
	DW( '</ul>\n' );
}

/* Add sbm
----------------------------------------------------------------------- */
function add_sbm( id ) {
	var url = document.URL;
	var title = document.title;
	if( SBM_URL != undefined ) {
		url = SBM_URL;
	}
	if( SBM_TITLE != undefined ) {
		title = SBM_TITLE;
	}

	switch( id ) {
	case "delicious":
		var sbm  = 'http://delicious.com/save';
			sbm += '?url=' + encodeURIComponent( url );
			sbm += '&title=' + encodeURIComponent( title );
			sbm += '&v=5';
		window.open( sbm );
		break;
	case "google":
		var sbm  = 'http://www.google.com/bookmarks/mark'
			sbm += '?op=edit';
			sbm += '&bkmk=' + encodeURIComponent( url );
			sbm += '&title=' + encodeURIComponent( title );
		window.open( sbm );
		break;
	case "hatena":
		var sbm  = 'http://b.hatena.ne.jp/add'
			sbm += '?mode=confirm';
			sbm += '&title=' + escape( title );
			sbm += '&url=' + escape( url );
		window.open( sbm );
		break;
	case "livedoor":
		var sbm  = 'http://clip.livedoor.com/redirect';
			sbm += '?link=' + encodeURIComponent( url );
			sbm += '&title=' + encodeURIComponent( title );
		window.open( sbm );
		break;
	case "nifty":
		var sbm  = 'http://clip.nifty.com/create';
			sbm += '?url=' + encodeURIComponent( url );
			sbm += '&title=' + encodeURIComponent( title );
		window.open( sbm );
		break;
	case "pookmark":
		var sbm  = 'http://pookmark.jp/post';
			sbm += '?url=' + encodeURIComponent( url );
			sbm += '&title=' + encodeURIComponent( title );
		window.open( sbm );
		break;
	case "yahoo":
		var sbm  = 'http://bookmarks.yahoo.co.jp/bookmarklet/showpopup';
			sbm += '?t=' + encodeURIComponent( title );
			sbm += '&u=' + encodeURIComponent( url );
			sbm += '&opener=bm&ei=UTF-8';
		window.open( sbm );
		break;
		
	case "minna":
		var sbm  = 'http://minna.topics.yahoo.co.jp/pu_list';
			sbm += '?url=' + encodeURIComponent( url );
			sbm += '&title=' + encodeURIComponent( title );
			sbm += '&opener=bm&ei=UTF-8';
		window.open( sbm );
		break;
	case "goo":
		var sbm  = 'http://bookmark.goo.ne.jp/add/detail';
			sbm += '?url=' + encodeURIComponent( url );
		window.open( sbm );
		break;

	case "buzzurl":
		var sbm  = 'http://buzzurl.jp/entry/';
			sbm += url;
		window.open( sbm );
		break;
	case "fc2":
		var sbm  = 'http://bookmark.fc2.com/user/post';
			sbm += '?url=' + encodeURIComponent( url );
			sbm += '&title=' + encodeURIComponent( title );
			window.open( sbm );
		break;
	case "iza":
		var sbm  = 'http://www.iza.ne.jp/bookmark/add/regist/back/';
			sbm +=escape( url );
			window.open( sbm );
		break;
	case "newsing":
		var sbm  = 'http://newsing.jp/add';
			sbm += '&title=' + encodeURIComponent( title );
			sbm += '?url=' + encodeURIComponent( url );
			window.open( sbm );
		break;

	case "facebook":
		var sbm  = 'http://www.facebook.com/sharer.php';
			sbm += '&t=' + encodeURIComponent( title );
			sbm += '?u=' + encodeURIComponent( url );
			window.open( sbm );
		break;


	case "blinklist":
		var sbm  = 'http://www.blinklist.com/index.php?Action=Blink/addblink.php';
			sbm += '&Title=' + encodeURIComponent( title );
			sbm += '?Url=' + encodeURIComponent( url );
			window.open( sbm );
		break;


	default:
		break;
	}

	return false;
}

function showSbPane(whichPane,flag){
	var thisPane = whichPane + 'Pane';
	var thisBtn = whichPane + 'Btn';
	var btnPath =YAHOO.util.Dom.get(thisBtn);
	
	if(flag===1){
		YAHOO.util.Dom.removeClass(thisPane, 'sorthide');
		YAHOO.util.Dom.addClass(thisPane, 'sortshow');
		btnPath.innerHTML =  '<a href="javascript:showSbPane(\''+whichPane+'\',0);"><img alt="閉じる" src="/images/icon_off.gif" width="27" height="15" /></a>';
	}else{
		YAHOO.util.Dom.removeClass(thisPane, 'sortshow');
		YAHOO.util.Dom.addClass(thisPane, 'sorthide');
		btnPath.innerHTML =  '<a href="javascript:showSbPane(\''+whichPane+'\',1);"><img alt="もっと" src="/images/icon_more.gif" width="27" height="15" /></a>';
	}
}


/*search genre option*/

function search_genre_option(form_name, pgenreid, parentname, genreid, sevalue, shopid, sortby, pricefrom, priceto,option_id){	
	//alert(document.detail.se.value);	
	//return false;
	window.document.forms[form_name].action="/"+option_id+"-op/"+parentname+"-"+pgenreid+"/cat-"+genreid+"-"+shopid+"-10-"+(Url.encode(document.detail.se.value)).replace(/%/g,"bb")+"-"+sortby+"-"+document.detail.pricefrom.value+"-"+document.detail.priceto.value+"-1.html";
	window.document.forms[form_name].submit();
}


function search_genre2(form_name, pgenreid, parentname, genreid, sevalue, shopid, sortby, pricefrom, priceto){	
	//alert(document.detail.se.value);	
	//return false;
	window.document.forms[form_name].action="/"+parentname+"-"+pgenreid+"/cat-"+genreid+"-"+shopid+"-10-"+(Url.encode(document.detail.se.value)).replace(/%/g,"bb")+"-"+sortby+"-"+document.detail.pricefrom.value+"-"+document.detail.priceto.value+"-1.html";
	window.document.forms[form_name].submit();
}


function ssearch_genre4(form_name, shopid, parentname, pgenreid, genreid, sevalue, sortby, pricefrom, priceto){
	//alert(document.detail.se.value);	
	//return false;
	window.document.forms[form_name].action="/"+shopid+"/"+parentname+"-"+pgenreid+"/cat-"+genreid+"-10-"+(Url.encode(document.detail.se.value)).replace(/%/g,"bb")+"-"+sortby+"-"+document.detail.pricefrom.value+"-"+document.detail.priceto.value+"-1.html";
	window.document.forms[form_name].submit();
}

/* END */