// 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('<h1 id="sllogo"><a href="\/D1/apr\/ap\/NList_h.dll\/?cgr=SL" title="SL Top"><img class="png_bg" src="\/d1\/images\/base\/d1sl_logo.png" alt="D1 STREET LEGAL" \/><\/a><\/h1>');
	document.write('<div id="d1sublg"><a href="\/d1\/apr\/ap\/NList_h.dll\/?cgr=GP" title="D1グランプリの情報はこちらへ"><span>D1 STREET LEGAL<\/span><\/a><\/div>');
}



// SPONSOR BAR
function sponsors_frm() {
	document.write('<div id="sponsor_box" style="width: 1003px; height: 56px; background:none;"><iframe src="\/d1\/sponsors\/sponsor_barflashtopSl.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; _top: 0; right: 0; z-index: 1000;"><a href="/D1/apr/ap/NList_h.dll/?cgr=GP"><img class="png_bg" src="/images/toppage/gotoGP.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/gotoGP_head.png); background-repeat: repeat-x;"></p>');
}



// PAGE FOOTER
function ___pgfooter() {
	document.write('<div id="d1footer"><p>Copyright 2011 &nbsp;D1 CORPORATION All Rights Reserved.<\/p><\/div>');
}

// PAGE FOOTER
function pgfooter() {
	document.write('<div id="d1footer" class="fltclr"><p class="ft_copy">Copyright 2011 &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\/sl\/index.html" title="HOME">HOME<\/a><\/p><\/div>');
}

function pgfooter_n() {
	document.write('<div id="d1footer" class="fltclr" style="padding-top:0px;"><p class="ft_copy">');
//	document.write('<a href="\/d1\/user\/index.html">D1 ユーザーデスク<\/a>&nbsp;|&nbsp;<a href="\/d1\/aboutD1\/outline.html">株式会社D1コーポレーション<\/a>&nbsp;|&nbsp;&nbsp;');
	document.write('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"><li><a href="/sl/sl2011/sluni/sluni_index.html">SL CHAMPION CARNIVAL</a></li><li><a href="/sl/sl2011/index_sl_ladys.html">レディースリーグ</a>&nbsp;|&nbsp;</li><li><a href="/sl/sl2011/index_sl_west.html">西日本 SERIES</a>&nbsp;|&nbsp;</li><li><a href="/sl/sl2011/index_sl_east.html">東日本 SERIES</a>&nbsp;|&nbsp;</li><li><a href="/sl/sl2011/index_sl_inter.html">インター SERIES</a>&nbsp;|&nbsp;</li><li><a href="/D1/apr/ap/NList_h.dll/?cgr=SL">TOP</a>&nbsp;|&nbsp;</li><!-- li><a href="/ticket/index_sl.html">チケット購入 </a>&nbsp;|&nbsp;</li --></ul>');
}

function d1footNavi2() {
	document.write('<ul class="d1footNavi fltclr"><li><a href="\/d1\/aboutD1\/outline.html">株式会社D1コーポレーション<\/a></li><li><a href="/d1/press/">プレス</a>&nbsp;|&nbsp;</li><li><a href="/d1/entrant/2012entry/license.html">エントラント</a>&nbsp;|&nbsp;</li><li><a href="/D1/apr/ap/NList_h.dll/?cgr=GP">D1 GRAND PRIX</a>&nbsp;|&nbsp;</li><li><a href="/sl/sl2011/index_sl_divs.html">D1 DIVISIONAL SERIES</a>&nbsp;|&nbsp;</li><li><a href="/sl/aboutD1/index.html">STREET LEGALとは</a>&nbsp;|&nbsp;</li></ul> ');
}




// 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

    //< ![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);
}

