
/*************************************************************************************/
//URLの取得
function geturlvars(url) {
	if(!url){
		url=window.location.href;
	}
	var vars = [], hash; 
	var hashes = url.slice(window.location.href.indexOf('?') + 1).split('&'); 
	for(var i = 0; i < hashes.length; i++) { 
		hash = hashes[i].split('='); 
		vars.push(hash[0]); 
		vars[hash[0]] = hash[1]; 
	} 
	return vars; 
}

/*************************************************************************************/
//要素にバインディングボックスを表示
function set_binding_box(jobj){
	jobj.append('<div class="binding_point" style="right:-5px; bottom:-5px; position:absolute;">');
	jobj.append('<div class="binding_point" style="right:-5px; top:-5px; position:absolute;">');
	jobj.append('<div class="binding_point" style="left:-5px; bottom:-5px; position:absolute;">');
	jobj.append('<div class="binding_point" style="left:-5px; top:-5px; position:absolute;">');
	jobj.append('<div class="binding_point" style="left:50%; top:-5px; position:absolute;">');
	jobj.append('<div class="binding_point" style="left:50%; bottom:-5px; position:absolute;">');
	jobj.append('<div class="binding_point" style="left:-5px; top:50%; position:absolute;">');
	jobj.append('<div class="binding_point" style="right:-5px; top:50%; position:absolute;">');
}

/*************************************************************************************/
//PHPのhtmlspecialcharsと同機能
function htmlspecialchars(ch) {
	ch = ch.replace(/&/g,"&amp;");
	ch = ch.replace(/\"/g,"&quot;");
	ch = ch.replace(/\'/g,"&#039;");
	ch = ch.replace(/</g,"&lt;");
	ch = ch.replace(/>/g,"&gt;");
	return ch;
}


/*************************************************************************************/
//ユニークなIDを発行（Jquery使用。引数もJqueryオブジェクト）
var g_uid=[];
(function($){
	$.fn.set_uid=function(mode,config){
		var defaults={
		}
		
		var uid;
		var id;
		this.each(function(i){
			if(!$(this).attr("uid") || $(this).attr("uid")==undefined){
				id=uid="";
				for (var i=0; i<8; i++) {
					for (var j=0; j<8; j++) {
						id += "abcdefghijklmnopqrstuvwxyz".charAt(Math.floor(Math.random() * 26));
					}
					if(jQuery.inArray(id,g_uid)==-1){
						uid=id;
						g_uid.push(uid);
						$(this).attr("uid",uid);
						return uid;
					}
				}
			}else{
				uid=$(this).attr("uid");
			}
		});
		return uid;
	};
})(jQuery);

/*************************************************************************************/
//ピクセル表記を数値に変換
function cast_px(pixel_str){
	return parseFloat(pixel_str.replace('px',''));
}







