var page_url = window.document.URL;
var page_title = document.title;

var url_check = new RegExp('http://.*?-.*?\.neticket\.jp.*?',"gi");
var url_match = page_url.match(url_check);
if(url_match){
	var page_url = page_url.replace(/^http:\/\/.*?-.*?/gi,'http://');
}
var url_check = new RegExp('https://.*?-.*?\.neticket\.jp.*?',"gi");
var url_match = page_url.match(url_check);
if(url_match){
	var page_url = page_url.replace(/^https:\/\/.*?-.*?/gi,'https://');
}

function twitterAdd() {
    var bitly_id  = 'neticket';
    var bitly_key = '';
    api = 'http://api.bit.ly/shorten' + '?version=2.0.1' + '&format=json' + '&callback=Callback' + '&login=' + bitly_id + '&apiKey=' + bitly_key + '&longUrl=';
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = api + encodeURIComponent(page_url) ;
    document.body.appendChild(script);
}

function Callback(json) {
	if(json.statusCode == "ERROR"){
		var url = 'http://twitter.com/home/?status=' + encodeURIComponent( page_title+' '+page_url);
	}
	else{
    var url = 'http://twitter.com/home/?status=' + encodeURIComponent( page_title+' '+json.results[page_url]['shortUrl']);
	}
    window.open(url);
}


function footerGet(){
	document.write("<a href='javascript:twitterAdd();' ><img src='/images/index/twitter.gif' style=\"display:inline; border-style:none; vertical-align:middle;\" /></a>&nbsp;");
	
	document.write("<a href=\"javascript:void window.open(\'http://bookmarks.yahoo.co.jp/bookmarklet/showpopup?t=\'+encodeURIComponent(document.title)+\'&u=\'+encodeURIComponent(window.location.href)+\'&opener=bm&ei=UTF-8\',\'popup\',\'width=750px,height=650px,status=1,location=0,resizable=1,scrollbars=1,left=150,top=150\',0);\"><img src=\"/images/index/sbm_yahoo.gif\"  alt=\"Yahoo!ブックマークに登録\" style=\"display:inline; border-style:none; vertical-align:middle;\"></a>&nbsp;");
	
	document.write("<a href=\"javascript:void window.open(\'http://www.google.com/bookmarks/mark?op=edit&bkmk=\'+encodeURIComponent(window.location.href)+\'&title=\'+encodeURIComponent(document.title)+\'&opener=bm&ei=UTF-8\',\'popup\',\'width=750px,height=650px,status=1,location=0,resizable=1,scrollbars=1,left=150,top=150\',0);\"><img src=\"/images/index/sbm_google.gif\" alt=\"Google!ブックマークに登録\" style=\"display:inline; border-style:none; vertical-align:middle;\"></a>&nbsp;");
	
	document.write("<a href=\"javascript:void window.open(\'http://clip.livedoor.com/redirect?link=\'+encodeURIComponent(window.location.href)+\'&title=\'+encodeURIComponent(document.title)+\'&opener=bm&ei=UTF-8\',\'popup\',\'width=750px,height=650px,status=1,location=0,resizable=1,scrollbars=1,left=150,top=150\',0);\"><img src=\"/images/index/sbm_livedoor.gif\"  alt=\"ライブドアクリップに投稿\" style=\"display:inline; border-style:none; vertical-align:middle;\"></a>&nbsp;");
	
}
