function getScriptUrl()
{
	var bee_script = "";
	var p = 0;
	if (typeof(document.scripts) != 'undefined')
	p=document.scripts.length ;
	for(i=0;i<p;i++)
	{
		x=document.scripts[i].src ;
		if(x.indexOf("Bee_Script=1")!="-1")
		{
			bee_script=document.scripts[i].src ;
			return bee_script;
		}
	}
	return window.location.href;

}
function getKeyword()
{
	var keyword='银座';
	url=getScriptUrl();
	if(url != ""){
		if(url. indexOf("keyword=") != -1){
			temp=url.substr(url.indexOf("keyword=")+8);
			url1=temp.split("&");
			keyword=url1[0];
		}
	}
	return keyword;
}

String.prototype.trim = function()
{
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

function go(url,newWindow){
	var key = keyword;
	if(typeof(key) == 'undefined' || key.trim() == '')
	key = getKeyword();

	/*if(url.search(/\?/) >= 0)
	url += "/" + getKeyword();
	else
	url += "/" + getKeyword();//*/
	re = /\(keyword\)/g;
	url = url.replace(re,keyword);
	if(newWindow){
		indow.open(url,'_blank','');
	}else{
		window.location.replace(url);
	}
	return false;
}

function setType(oForm){
	var theType = 'top';
	if(typeof(type) != 'undefined') theType = type;
	oForm.type.value = theType;
}

function revertSlash(text){
	var re=/%2F/gi;
	text = text.replace(re,' ');
	return text;
}

function showImage(url,title,index){
	var eCurImg = document.getElementById('curImage');
	eCurImg.src=FILE_SERVER + '/images/indicator_large.gif';
	eCurImg.alt='loading';
	eCurImg.onload=function (){
		var eCurImg = document.getElementById('curImage');
		eCurImg.onload = function(){};
		eCurImg.src=url;
		eCurImg.alt=title;
	};
	var eCurImg = document.getElementById('viewCurImage');
	eCurImg.href=url;
	eCurImg.title=title;
	curImgIdx = index;
	return false;
}

function changeShop(shop){
	var selectShop=document.getElementById('shop');
	if(selectShop){
		for(var i=0; i<selectShop.options.length; i++){
			if(selectShop.options[i].value==shop){
				selectShop.options[i].selected  = true;
				break;
			}
		}
	}
	return false;
}

function doSubmit(form){
	var theForm = document.getElementById(form);
	if(theForm){
		theForm.submit();
	}
}

function imageNotFound(img,instead1,instead2){
	if(img.src != instead1){
		img.src = instead1;
	}else if(img.src != instead2){
		img.src = instead2;
	}
}

function search(keyword){
	var objForm = document.getElementById('searchForm');
	if(objForm){
		var objKeyword = document.getElementById('searchKeyword');
		if(objKeyword){
			setType(objForm);
			objKeyword.value=keyword();
			alert('submit');
			objForm.submit();
		}
	}
	return false;
}
