function lastof(es) { return es[es.length - 1]; }
function dirname(path) { return path.substring(0, path.lastIndexOf('/')); }
var path = dirname(lastof(document.getElementsByTagName('script')).src);

var importSrc = function(e){
	return '<script type="text/javascript" src="'+ e +'"></script>' + "\n";
}

// Current Protcol Check
var currentProtcol = 'https:' == document.location.protocol ? 'https://' : 'http://';

// Mode Check
var qerStr = window.location.search.split('&');
var qerFlag = false;
for (qerStrCnt in qerStr) {
	if(qerStr[qerStrCnt] == 'task=edit') {
		qerFlag = true;
		break;
	}
}

document.write( importSrc( path + '/gaq.js' ) );
if(qerFlag) {
	document.write( importSrc( currentProtcol + 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js' ) );
} else {
	document.write( importSrc( path + '/jquery-1.3.2.min.js' ));
}
//document.write( importSrc( 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' ) );
document.write( importSrc( path + '/jquery.dropdownPlain.js' ) );
document.write( importSrc( path + '/swfobject.js' ) );
document.write( importSrc( path + '/common.js' ) );

var userAgent = window.navigator.userAgent.toLowerCase();
var appVersion = window.navigator.appVersion.toLowerCase();


if (userAgent.indexOf("msie") > -1) {
	if (appVersion.indexOf("msie 6.0") > -1) {
		document.write( importSrc( path + '/DD_belatedPNG_0.0.8a-min.js' ) );
		document.write( importSrc( path + '/IE6.js' ) );
		document.write( importSrc( currentProtcol + 'html5shiv.googlecode.com/svn/trunk/html5.js' ) );
	}
	else if (appVersion.indexOf("msie 7.0") > -1) {
		document.write( importSrc( currentProtcol + 'html5shiv.googlecode.com/svn/trunk/html5.js' ) );
	}
	else if (appVersion.indexOf("msie 8.0") > -1) {
		document.write( importSrc( currentProtcol + 'html5shiv.googlecode.com/svn/trunk/html5.js' ) );
	}
}
