function mode_href(prefix) {
	var s_http = 'http';
	var s_http_len = s_http.length;
	
	var basic_url = 'http://www.salencoupon.com';
	var basic_url_len = basic_url.length;
	
	var short_url = 'http://salencoupon.com';
	var short_url_len = short_url.length;
	
	var objs = document.getElementsByTagName('A');		
	var obj_len = objs.length;
	
	var i = 0;
	var href_host;
	for(i=0;i<obj_len;i++) {
		if(objs[i].href.substr(0, s_http_len) != s_http)
			continue;
		basic_link = objs[i].href.substr(0, basic_url_len);
		short_link = objs[i].href.substr(0, short_url_len);
		if(basic_link != basic_url && short_link != short_url) {
			objs[i].href = prefix+objs[i].href;
			objs[i].target = 'a';
		}
	}
}

function setTitle(title) {
	document.title = title;
}

function resizeImg(imgid, max_w) {
	var imgs = document.getElementsByName(imgid);
	var imgcnt = imgs.length;	
	var w, h;	
	for(i=0;i<imgcnt;i++) {	
		var imgPreview = new Image();		
		imgPreview.src = imgs[i].src;
		w = imgPreview.width;		
		h = imgPreview.height;
		if(w <= 0 && h <=0) {
			imgPreview.onload = function(){ w=imgPreview.width; h=imgPreview.height;};
		}
		if(w > max_w) {
			//alert('b:'+w+':'+h);
			h = Math.ceil((max_w * h ) / w);
			w = max_w;
			//alert('a:'+w+':'+h);
			imgs[i].width = w;
			imgs[i].height = h;
		}
	}
}

function goShop(shopurl, suffix) {	
	shop = document.getElementById('shoplist');	
	if(shop.selectedIndex == 0) {
		return;
	}
	document.location.href=shopurl+shop.value+suffix;
}
