/* $Id: IncludeSDPScripts.js,v 1.14 2010/04/30 08:38:57 siddik Exp $ */

_editor_url = "./";
_editor_lang = "en";
var agt = navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_opera  = (agt.indexOf("opera") != -1);
var is_mac	   = (agt.indexOf("mac") != -1);
var is_mac_ie = (is_ie && is_mac);
var is_win_ie = (is_ie && !is_mac);
var is_gecko  = (navigator.product == "Gecko");

function getJsInc(path) {
	return "<script src='" + path + "?" + buildNumber + "' type='text/javascript'></script>";
}

var buildNumber = '7007';

/**
 * This is an include script which will load all the necessary js files for SDP
 * to run successfully. Any new js file should be added here.
 *
 * @contextPath	indicates the contextPath of the current application
 * @htmlArea	indicates whether scripts related to HTMLArea should be added or not
 */
function includeSDPScripts(contextPath, htmlArea,number,locale) {
	if(locale != null ) {
	_editor_lang=locale.toLowerCase();
	}
	var scriptsToInclude = "";
	// Common 
	if(number != null ) {
		buildNumber = number;
	}
	if(parent["INCLUDED"] != null) {
		return;
	}
	
	var contextIndex = contextPath.indexOf("/sd");
	if(contextIndex!=-1){
		scriptsToInclude += getJsInc(contextPath + "/scripts/jquery-1.3.2.min.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/SCPJquery.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/AjaxAPI.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/common.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/ValidateUserDetails.js");//No I18N
	}
	else{
		scriptsToInclude += getJsInc(contextPath + "/scripts/jquery-1.3.2.min.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/SCPJquery.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/thirdpartyscp.js");//No I18N
		// Calendar Starts
		scriptsToInclude += getJsInc(contextPath + "/scripts/calendar.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/calendar-en.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/calendar-setup.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/PopCalendar.js");//No I18N
		// Calendar Ends
		scriptsToInclude += getJsInc(contextPath + "/scripts/scp.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/scripts/ajax.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/framework/javascript/frameworkscp.js");//No I18N
		scriptsToInclude += getJsInc(contextPath + "/components/javascript/componentlistscp.js");//No I18N
	}
	
	/*
	scriptsToInclude += getJsInc(contextPath + "/scripts/jquery-1.3.2.min.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/SCPJquery.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/ubertooltip.js");
	scriptsToInclude += getJsInc(contextPath + "/scripts/prototype.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/scriptaculous.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/dropdown.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/unittest.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/dialog.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/effects.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/dragdrop.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/controls.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/Colour.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/ColourPicker.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/cooltreepro.js");//No I18N 
	scriptsToInclude += getJsInc(contextPath + "/scripts/mktree.js");//No I18N 
	scriptsToInclude += getJsInc(contextPath + "/scripts/overlib.js");//No I18N 
	scriptsToInclude += getJsInc(contextPath + "/scripts/201a.js");//No I18N 

	scriptsToInclude += getJsInc(contextPath + "/scripts/calendar.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/calendar-en.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/calendar-setup.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/PopCalendar.js");//No I18N	
	
	scriptsToInclude += getJsInc(contextPath + "/scripts/Login.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/SRequestScripts.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/CustomersValidate.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/common.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/tree_format.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/tree1_format.js");//No I18N 
	scriptsToInclude += getJsInc(contextPath + "/scripts/CategoryDefinition.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/AjaxAPI.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/ajax.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/admin.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/portal-settings.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/SCPAjax.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/reports.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/GeneralScripts.js");
	scriptsToInclude += getJsInc(contextPath + "/scripts/CRCCheck.js");
	scriptsToInclude += getJsInc(contextPath + "/scripts/reminder.js");
	scriptsToInclude += getJsInc(contextPath + "/scripts/Popup.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/Solution.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/workorder.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/validation.js"); //No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/ValidateUserDetails.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/AdminValidateAction.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/attachment.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/ITILCommon.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/utils.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/layerfader.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/scripts/ouTree.js");//No I18N 
	scriptsToInclude += getJsInc(contextPath + "/scripts/PopupWindow.js");//No I18N 
	scriptsToInclude += getJsInc(contextPath + "/scripts/dynamicInput.js");//No I18N 
	scriptsToInclude += getJsInc(contextPath + "/scripts/nifty.js");//No I18N 

	scriptsToInclude += getJsInc(contextPath + "/framework/javascript/StateHandling.js"); //No I18N
	scriptsToInclude += getJsInc(contextPath + "/framework/javascript/ResponseHandling.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/framework/javascript/IncludeJS.js");//No I18N 
	scriptsToInclude += getJsInc(contextPath + "/components/javascript/Utils.js");
	scriptsToInclude += getJsInc(contextPath + "/components/javascript/TableHandling.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/components/javascript/viewcreation/DO.js");//No I18N
	scriptsToInclude += getJsInc(contextPath + "/components/javascript/FormUtils.js");//No I18N
	
	// Category Definition
	// HTMLArea
	if(htmlArea != null && htmlArea) {
		scriptsToInclude += getJsInc(contextPath + "/scripts/htmlarea.js");
		scriptsToInclude += getJsInc(contextPath + "/lang/en.js");
		//scriptsToInclude += getJsInc(contextPath + "/lang/"+_editor_lang+".js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/advhtmlarea.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/combobox.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/insert_image.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/insert_table.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/utils.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/dialog.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/select_color.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/writer.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/docutils.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/link.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/spellchecker.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/iframeutil.js");
		scriptsToInclude += getJsInc(contextPath + "/scripts/menuaction.js");
		scriptsToInclude += getJsInc(contextPath + "/components/javascript/Dialog.js");
		scriptsToInclude += getJsInc(contextPath + "/components/javascript/Effects.js");
	}*/
	document.writeln(scriptsToInclude);
	parent["INCLUDED"] = "true";
}

