function ScreenChecker(){
	// Check URL list
	// '.' is DirectoryIndex
	var pcPage = ['index.html', '_DIR_'];
	var iphonePage = ['index_iph.html', 'index_iph.html'];
	var ipadPage = ['index_ipa.html', 'index_ipa.html'];

	var ua = navigator.userAgent;
	var url = document.URL;
	// PC
	// iPod touch      : 320x480
	// iPhone, 3G, 3GS : 320
	// iPhone 4        : 640x960
	// iPad            : 768x1024

	var i = 0;

	// Check device
	if(ua.indexOf('iPhone') > -1 || ua.indexOf('iPod')  > -1){
		// iPod, iPhone
		for(i=0; i<iphonePage.length; i++){
			if(ipadPage[i] == '_DIR_' &&  url.indexOf('.html') < 0 ||
				pcPage[i] == '_DIR_' &&  url.indexOf('.html') < 0 ||
				url.indexOf(ipadPage[i]) > -1 || url.indexOf(pcPage[i]) > -1){
				location.href = iphonePage[i];
				break;
			}
		}
	}else if(ua.indexOf('iPad') > -1){
		// iPad
		for(i=0; i<ipadPage.length; i++){
			if(pcPage[i] == '_DIR_' &&  url.indexOf('.html') < 0 ||
				iphonePage[i] == '_DIR_' &&  url.indexOf('.html') < 0 ||
				url.indexOf(pcPage[i]) > -1 || url.indexOf(iphonePage[i]) > -1){
				location.href = ipadPage[i];
				break;
			}
		}
	}else{
		// Pc
		for(i=0; i<pcPage.length; i++){
			if(iphonePage[i] == '_DIR_' &&  url.indexOf('.html') < 0 ||
				ipadPage[i] == '_DIR_' &&  url.indexOf('.html') < 0 ||
				url.indexOf(iphonePage[i]) > -1 || url.indexOf(ipadPage[i]) > -1){
				location.href = pcPage[i];
				break;
			}
		}
	}
}
ScreenChecker();

