// Hide MAINBODY
function closemainb() {
	document.getElementById('d1main_body').style.display='none';
	document.getElementById('closebtn').style.display='none';
	document.getElementById('openbtn').style.display='block';
}

function openmainb() {
	document.getElementById('d1main_body').style.display='block';
	document.getElementById('openbtn').style.display='none';
	document.getElementById('closebtn').style.display='block';
}


function closemainb2() {
	document.getElementById('d1main_bodyTop').style.display='none';
	document.getElementById('closebtn').style.display='none';
	document.getElementById('openbtn').style.display='block';
}

function openmainb2() {
	document.getElementById('d1main_bodyTop').style.display='block';
	document.getElementById('openbtn').style.display='none';
	document.getElementById('closebtn').style.display='block';
}




// MAIN LOGO
function d1logos() {
	document.write('<div id="topbg" class="png_bg"><br \/><\/div>');
	document.write('<h1 id="d1logo"><a href="\/d1\/apr\/ap\/NList_h.dll\/?cgr=GP" title="D1 GRAND PRIX"><img class="png_bg" src="\/d1\/images\/base\/d1gp_logo.png" alt="D1 GRAND PRIX" \/><\/a><\/h1>');
	document.write('<div id="d1sublg"><a href="\/sl\/" title="D1ストリートリーガルの情報はこちらへ"><span>D1 STREET LEGAL<\/span><\/a><\/div>');
	document.write('<div id="srsponsor"><a href="http:\/\/www.gran-turismo.com\/jp\/" title="GRAN TOURISMO" target="_blank"><img class="png_bg" src="\/d1\/images\/base\/gt_logo.png" alt="GRAN TOURISMO" \/><\/a><\/div>');

//	document.write('<h1 id="d1logo"><a href="\/D1/apr/ap/NList_h.dll/?cgr=GP" title="Top Page"><img class="png_bg" src="\/d1\/images\/toppage\/d1gp_logo.png" alt="D1 GRAND PRIX" \/><\/a><\/h1>');
//	document.write('<div id="srsponsor"><a href="http:\/\/www.gran-turismo.com\/" target="_blank"><img class="png_bg" src="\/d1\/images\/toppage\/gt_logo.png" alt="GRAN TOURISMO" \/><\/a><\/div>');
}



// SPONSOR BAR
function sponsors_frm() {
	document.write('<div id="sponsor_box" style="width: 1003px; height: 56px;"><iframe src="\/d1\/sponsor\/sponsors_gp.html" name="sponsors_bar" id="sponsors_bar" border="0" frameborder="0" framespacing="0" scrolling="no" allowTransparency="true" style="margin:0;padding:0;width:1003px;height:56px;"><\/iframe><\/div>');
//	document.write('<p style="position:fixed; top: 0; right: 0; z-index: 1000;"><a href="/D1/apr/ap/NList_h.dll/?cgr=SL"><img class="png_bg" src="/images/toppage/gotoSL.png" alt="D1 GRAND PRIX" /></a></p><p style="position:fixed; top: 0; right: 0; z-index: 990; width: 100%; height: 2px; background:url(/images/toppage/gotoSL_head.png); background-repeat: repeat-x;"></p>');
//	document.write('<p style="position:fixed; top: 0; _top: 0; right: 175px; z-index: 900;"><a href="/d1/index_topen.html"><img class="png_bg" src="/d1/images/items/englishbtn2.png" alt="D1 GRAND PRIX" /></a></p><p style="position:fixed; top: 0; _top: 0; right: 0; z-index: 990; width: 100%; height: 2px; background:url(/images/toppage/gotoSL_head.png); background-repeat: repeat-x;"></p>');
}


function sponsors_frm2() {
	document.write('<div id="sponsor_box" style="width:1003px;height:56px;"><iframe src="\/d1\/sponsor\/sponsors_gp.html?top" name="sponsors_bar" id="sponsors_bar" border="0" frameborder="0" framespacing="0" scrolling="no" allowTransparency="true" style="margin:0;padding:0;width:1003px;height:56px;"><\/iframe><\/div>');
//	document.write('<p style="position:fixed; top: 0; right: 0; z-index: 1000;"><a href="/D1/apr/ap/NList_h.dll/?cgr=SL"><img class="png_bg" src="/images/toppage/gotoSL.png" alt="D1 GRAND PRIX" /></a></p><p style="position:fixed; top: 0; right: 0; z-index: 990; width: 100%; height: 2px; background:url(/images/toppage/gotoSL_head.png); background-repeat: repeat-x;"></p>');
}






// PAGE FOOTER
function pgfooter() {
//	socialbtn();
	document.write('<div id="d1footer" class="fltclr"><p class="ft_copy">Copyright 2012 &nbsp;D1 CORPORATION All Rights Reserved.<\/p>');
	document.write('<p class="ft_back"><a class="png_bg" href="#BACK" onclick="history.back();return false" title="BACK">BACK<\/a><\/p>');
	document.write('<p class="ft_home"><a class="png_bg" href="\/d1\/index_top.html" title="HOME">HOME<\/a><\/p><\/div>');
}


function pgfooter_n() {
//	socialbtn();
	document.write('<div id="d1footer" class="fltclr" style="padding-top:0px;"><p class="ft_copy">Copyright 2011 &nbsp;D1 CORPORATION All Rights Reserved.<\/p><\/div>');
}




// ROUND BADGE 2
function rndbadge2() {
//	document.write('<div class="d1rd_badge2" style="left:360px; top:10px; width:233px;"><a href="\/d1\/gp\/gp2010\/index.html" title="D1GP" ><img class="png_bg" src="\/d1\/gp\/gp_img\/10series\/10cal_badge_s.png" alt="Next Round" style="margin: 5px 0 0 0; vertical-align:top;" \/></a><\/div>');
}

function rndbadge3() {
	document.write('<div class="d1rd_badge2" style="left:265px; top:10px;"><a href="\/d1\/gp\/gp2010\/index.html" title="D1GP" ><img class="png_bg" src="\/d1\/gp\/gp_img\/10series\/10cal_badge_e.png" alt="Next Round" style="margin: 5px 0 0 50px; vertical-align:top;" \/></a><\/div>');
}


// CLOSE MAINBODY
function closebody() {
	document.write('<div class="close_mainbody"><a id="closebtn" href="#" onclick="closemainb();return false;" title="CLOSE">&times;<\/a>');
	document.write('<a id="openbtn" href="#" onclick="openmainb();return false;" title="OPEN" style="display:none;">+<\/a><\/div>');
}

function closebody2() {
	document.write('<div class="close_mainbody"><a id="closebtn" href="#" onclick="closemainb2();return false;" title="CLOSE">&times;<\/a>');
	document.write('<a id="openbtn" href="#" onclick="openmainb2();return false;" title="OPEN" style="display:none;">+<\/a><\/div>');
}



function d1footNavi1() {
	document.write('<ul class="d1footNavi fltclr">');
	document.write('<li><a href="\/d1\/index_topen.html">ENGLISH<\/a><\/li>');
	document.write('<li><a href="\/d1\/aboutD1\/outline.html">株式会社D1コーポレーション<\/a>&nbsp;|&nbsp;<\/li>');
	document.write('<li><a href="\/d1\/press\/index_gp_release.html">プレス<\/a>&nbsp;|&nbsp;<\/li>');
	document.write('<li><a href="\/d1\/entrant\/2012entry\/license.html">エントラント<\/a>&nbsp;|&nbsp;<\/li>');
	document.write('<li><a href="\/d1\/sl\/">D1 STREET LEGAL<\/a>&nbsp;|&nbsp;<\/li>');
	document.write('<li><a href="\/d1\/">D1 GRAND PRIX<\/a>&nbsp;|&nbsp;<\/li>');
	document.write('<li><a href="\/d1\/ticket\/">チケット購入<\/a>&nbsp;|&nbsp;<\/li>');
	document.write('<\/ul>');
}

function xxd1footNavi1() {
	document.write('<ul class="d1footNavi fltclr"><li><a href="\/d1\/aboutD1\/outline.html">株式会社D1コーポレーション<\/a><\/li><li><a href="\/press\/index_gp_release.html">プレス<\/a>');
	document.write('&nbsp;|&nbsp;<\/li><li><a href="\/d1\/entrant\/2012entry\/license.html">エントラント<\/a>');
	document.write('&nbsp;|&nbsp;<\/li><li><a href="\/D1\/apr\/ap\/NList_h.dll\/?cgr=SL">D1 STREET LEGAL<\/a>');
	document.write('&nbsp;|&nbsp;<\/li><li><a href="\/d1\/aboutD1\/world_drift.html">WORLD DRIFT<\/a>&nbsp;|&nbsp;<\/li><li><a href="\/d1\/aboutD1\/">D1 GRAND PRIXとは?<\/a>');
	document.write('&nbsp;|&nbsp;<\/li><li><a href="\/d1\/gp\/gp2011\/">スケジュール<\/a>&nbsp;|&nbsp;<\/li><li><a href="#">TOP<\/a>');
	document.write('&nbsp;|&nbsp;<\/li><!-- li><a href="\/ticket\/index.html">チケット購入<\/a>&nbsp;|&nbsp;<\/li --><\/ul>');
}



function socialbtn() {
	document.write('<div class="socialbtns fltclr">');
	//	document.write('<div class="sbhatena"><a id="hb_like" href="http:\/\/b.hatena.ne.jp\/entry\/"');
	//	document.write(' class="hatena-bookmark-button" data-hatena-bookmark-layout="simple" title="このエントリーをはてなブックマークに追加"><img');
	//	document.write(' src="http:\/\/b.st-hatena.com\/images\/entry-button\/button-only.gif" alt="このエントリーをはてなブックマークに追加" width="20" height="20" style="border: none;" \/>');
	//	document.write('<\/a><scri' + 'pt type="text\/javascript" src="http:\/\/b.st-hatena.com\/js\/bookmark_button.js" charset="utf-8" async="async"><\/scri');
	//	document.write('pt><scri' + 'pt type="text\/javascript">document.getElementById("hb_like").href="http:\/\/b.hatena.ne.jp\/entry\/"+location.href<\/scr');
	//	document.write('ipt><\/div>');
	document.write('<div class="sbgree"><iframe src="http:\/\/share.gree.jp\/share?url=' + encodeURIComponent(top.location.href));
	document.write('&amp;type=0&amp;height=16" scrolling="no" frameborder="0" marginwidth="0" marginheight="0"');
	document.write(' allowTransparency="true" style="border:none; overflow:hidden; width:61px; height:16px;"><\/iframe><\/div>');
	document.write('<div class="sbmixi"><a href="http:\/\/mixi.jp\/share.pl" class="mixi-check-button" data-key="a7c5c670f5f9e3a2b884318db307bf569cdb1a55"');
	document.write(' data-url="" data-button="button-1">Check<\/a><scri' + 'pt type="text\/javascript" src="http:\/\/static.mixi.jp\/js\/share.js"><\/scr');
	document.write('ipt><\/div>');
	document.write('<div class="sbgoplus"><scri' + 'pt type="text\/javascript" src="https:\/\/apis.google.com\/js\/plusone.js">{lang:"ja"}<\/scri');
	document.write('pt><g:plusone size="medium" count="false"><\/g:plusone><\/div>');
	document.write('<div class="sbfacebook"><iframe id="fb_like" src="" scrolling="no" frameborder="0" allowtransparency="true"');
	document.write(' style="border:none; overflow:hidden; width:100px; height:21px; position:relative;"><\/iframe><scri');
	document.write('pt type="text\/javascript">document.getElementById("fb_like").src="http:\/\/www.facebook.com\/plugins\/like.php?href');
	document.write('="+top.location.href+"&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light&height=21"<\/scri' + 'pt><\/div>');
	document.write('<div class="sbtweet"><a href="http:\/\/twitter.com\/share" class="twitter-share-button" data-count="none">Tweet<\/a><scri');
	document.write('pt type="text\/javascript" src="http:\/\/platform.twitter.com\/widgets.js"><\/scri' + 'pt><\/div><\/div>');
}






// SSL Check
function chkssl() {
	if (window.location.host=="www.d1gp.co.jp" && document.location.protocol==="http:") {
		location.replace('https://'+window.location.host+window.location.pathname);
	}
}


// SSL off
function offssl() {
	if (document.location.protocol==="https:") {
		location.replace('http://'+window.location.host+window.location.pathname);
	}
}






// iPad
function oldiphones() {
	//< ![CDATA[
		vborder("/global/iphone.css","/global/iphone.css","/global/iphone.css.css");
	//]]>

	function vborder(){
		window.iPad = /iPad/.test(navigator.userAgent);
		if(iPad){
			var args = arguments,
			d = document,
			head = d.getElementsByTagName('head'),
				linktag = function(h,m){
				var tag = d.createElement("link");
				tag.href = h;
				tag.media = m;
				tag.type = "text/css";
				tag.rel = "stylesheet";
				return tag;
				};
			if(args[0]) head.item(0).appendChild(linktag(args[0],"only screen and (max-device-width: 1024px)"));
			if(args[1]) head.item(0).appendChild(linktag(args[1],"all and (orientation:landscape)"));
			if(args[2]) head.item(0).appendChild(linktag(args[2],"all and (orientation:portrait)"));
		}
	};
}

// Thanks to BraveNewCode's WPtouch iPhone Theme for the UA list.
// (http://wordpress.org/extend/plugins/wptouch/)
function is_mobile () {
	var useragents = [
		'iPhone',         // Apple iPhone
		'iPod',           // Apple iPod touch
		'Android',        // 1.5+ Android
		'dream',          // Pre 1.5 Android
		'CUPCAKE',        // 1.5+ Android
		'blackberry9500', // Storm
		'blackberry9530', // Storm
		'blackberry9520', // Storm v2
		'blackberry9550', // Storm v2
		'blackberry9800', // Torch
		'webOS',          // Palm Pre Experimental
		'incognito',      // Other iPhone browser
		'webmate'         // Other iPhone browser
	];
	var pattern = new RegExp(useragents.join('|'), 'i');
	return pattern.test(navigator.userAgent);
}
if (is_mobile()) {
	var link = document.createElement('link');
	link.rel = 'stylesheet';
	link.type = 'text/css';
	link.href = '/global/iphone.css';
	document.getElementsByTagName('head')[0].appendChild(link);
}



