//************************************************************************************
// Description : Mobile device Check
// Parameter: void
// Return: true / false
// Usage: 
//************************************************************************************
function checkMobile() {
	var t_var = false;
	var agent=navigator.userAgent.toLowerCase();
	for (var i = 0; i < devices.length; i++) {
		if (agent.indexOf(devices[i]) != -1) {
			t_var = true;
			break;
		}
	} return t_var; }

//************************************************************************************
// Description : Set Cookie
// Parameter: cookieName, cookieValue, expireDate
// Return: 
// Usage: 
//************************************************************************************
function setCookieMobile(cookieName, cookieValue, expireDate) {
	var today = new Date();
	today.setDate(today.getDate() + parseInt(expireDate));
	document.cookie = cookieName + "=" + escape(cookieValue) + "; path=/; expires=" + today.toGMTString() + ";";
}
 // Mobile Device Array
var devices = new Array ( 	'iphone','ipad','android','windows ce','blackberry','symbian','baba' );
 // Mobile Device Global Variable
var isMobile = checkMobile();
// Mobile Deice and BandWidth Check
if (isMobile) { 	if (getCookie("PreferBandwidth") != "Low") {
		setCookieMobile("PreferBandwidth", "Low", 999); 
		window.location.reload();
 	}
}

//************************************************************************************
// Description : Print Flash Movie with Bandwidth check
// Parameter: Movie URL, Movie width, Movie height, Movie window mode, Movie Script allow
// Usage: 
//************************************************************************************

function printFlash(fURL,fWidth,fHeight,fWindow,fAllow)	{
	if (getCookie("PreferBandwidth") == "Low") return;
	if (fURL) {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + fWidth + '" height="' + fHeight + '">');
		document.write('<param name="movie" value="' + fURL + '">');
		if(fWindow)	document.write('<param name="wmode" value="' + fWindow + '">');
		if(fAllow)	document.write('<param name="allowScriptAccess" value="' + fAllow + '">');
		document.write('<!--[if !IE]><--><object type="application/x-shockwave-flash" data="' + fURL + '" width="' + fWidth + '" height="' + fHeight + '"');
		if(fWindow)	document.write(' wmode="' + fWindow + '"');
		if(fAllow)	document.write(' allowScriptAccess="' + fAllow + '"');
		document.write('><!--> <![endif]-->');
		document.write('<p><a href="http://www.adobe.com/go/getflashplayer" target="_blank"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>');
		document.write('<!--[if !IE]> <--></object><!--><![endif]-->');
		document.write('</object>');
	}
}

