// set the build number for the site
//document.title = 'Build ##build## - ' + document.title ;
//window.status = 'Cadillac Build ##build##' ;

//This function preloads the global navigation elements
var navRoll = false;
//Set this variable to false so no global rollovers will work until all preloading is done.
function plGnav()
{
	plImages();
	navRoll = true;
}

//This function preloads rollover images with a & i suffixes for active and inactive
//The function can preload any number of images.
//usage: uPreload( object name, directory of image, extension of image )
var imgSuffix = new Array('i', 'a');
function uPreload(imgName, imgPath, imgExt)
{
	//alert(imgExt);
	for (i=0; i < imgSuffix.length; i++) {
		eval( imgName + imgSuffix[i] + " = new Image();" );
  		eval( imgName + imgSuffix[i] + ".src = '" + imgPath + '/' + imgName + imgSuffix[i] + imgExt + "';" );
    }
}
 
function plImages()
{
	var linkArray = document.getElementsByTagName("img");
    for (var loop=0; loop<linkArray.length; loop++)
    {
    	imgClassArray = linkArray[loop].className.split(' ');
        for (var i=0; i<imgClassArray.length; i++)
        {
         	if (imgClassArray[i] == "pl")
         	{
    			var imgPath = linkArray[loop].src.substring( 0, linkArray[loop].src.lastIndexOf( '/' ));
    			uPreload( linkArray[loop].id, imgPath, linkArray[loop].src.substring( linkArray[loop].src.lastIndexOf( '.' ) ) );
         	}
        }
    }
}
 
function getElementsByClassName(clsName) 
{ 
	var arr = new Array(); 
	var elems = document.getElementsByTagName("*");
	for ( var cls, i = 0; ( elem = elems[i] ); i++ )
	{
		if ( elem.className == clsName )
		{
			arr[arr.length] = elem;
		}
	}
	return arr;
}
 
function fnEnableMenu(uName, uState, pUname) 
{
	var elementList, i=0;
	var imgName,pos, dropMenu_id;
	navRoll = true;
	var menu_ids = new Array();
	menu_ids['ftr_navgal'] = 1;
	menu_ids['ftr_navpack'] = 2;
	menu_ids['ftr_navcomp'] = 3;
	menu_ids['ftr_navshop'] = 4;
	menu_ids['ftr_navlocate'] = 5;
	id = menu_ids[uName];
 	dropMenu_id = menu_ids[pUname];
	for(var i=1;i<7;i++)
	{
		document.getElementById(i).src = '../images/div1.gif';
	}
	var sunMenu_id = getElementsByClassName('secondLevelMenu');
	for(var j=0; j < sunMenu_id.length; j++)
	{
		//document.images[sunMenu_id[j].id].src = "images/"+[sunMenu_id[j].id+"i.gif";
	}

	if(navRoll)
	{
	  //document.images[uName].src = "images/"+uName+uState+".gif";
	}
	document.images[uName].src = "../images/"+uName+"a.gif";
	document.images[pUname].src = "../images/"+pUname+"a.gif";

	document.getElementById(id).src = '../images/div.gif';
	document.getElementById(id+1).src = '../images/div.gif';
	document.getElementById(dropMenu_id).src = '../images/div.gif';
	document.getElementById(dropMenu_id+1).src = '../images/div.gif';
	
}
 
//This function is for navigation rollover images; uName is name of graphic, uState is on, off or over state

function nr(uName, uState)
{
	var elementList, i=0;
	var imgName,pos, dropMenu_id;
	navRoll = true;
	var menuList;
	var menu_ids = new Array();
	menu_ids['ftr_navgal'] = 1;
	menu_ids['ftr_navpack'] = 2;
	menu_ids['ftr_navcomp'] = 3;
	menu_ids['ftr_navshop'] = 4;
	menu_ids['ftr_navlocate'] = 5;

	menuList = uName.split(",");

	// Nav Menu Values
	if(menuList.length == 2)
	{
		uName = menuList[0];
		pUname = menuList[1];

		id = menu_ids[uName];
		e_id = menu_ids[pUname];	

		//  to make all divider hide
		for(var i=1;i<7;i++)
		{
			document.getElementById(i).src = '../images/div1.gif';
		}

		// get all id using getElementsByClassName
		var sunMenu_id = getElementsByClassName('secondLevelMenu');
		for(var j=0; j < sunMenu_id.length; j++)
		{
			document.getElementById(sunMenu_id[j].id).src = "../images/"+sunMenu_id[j].id+"i.gif";;
	
		}

		document.images[pUname].src = "../images/"+pUname+"a.gif";
		document.getElementById(e_id).src = '../images/div.gif';
		document.getElementById(e_id+1).src = '../images/div.gif';
		
		if(id)
		{
			if(uState == 'a')
			{
				document.images[uName].src = "../images/"+uName+"a.gif";
				document.getElementById(id).src = '../images/div.gif';
				document.getElementById(id+1).src = '../images/div.gif';
				document.getElementById(e_id).src = '../images/div.gif';
				document.getElementById(e_id+1).src = '../images/div.gif';
			}
	
			if(uState == 'i')
			{
				if(id ==3 || id ==5)
				{
					document.images[uName].src = "../images/"+uName+"i.gif";
					document.getElementById(id).src = '../images/div1.gif';
					document.getElementById(id+1).src = '../images/div1.gif';
				}
				else
				{
					document.images[uName].src = "../images/"+uName+"a.gif";
					document.getElementById(id).src = '../images/div.gif';
					document.getElementById(id+1).src = '../images/div.gif';
				}
			}
			
			if(uState == 'c')
			{
				document.images[uName].src = "../images/"+uName+"i.gif";
				if(id == e_id || id == e_id+1)
				{
					document.getElementById(id+1).src = '../images/div1.gif';
				}
				else
				{
					document.getElementById(id).src = '../images/div1.gif';
					document.getElementById(id+1).src = '../images/div1.gif';
				}
			}
			if(uState == 'd')
			{
				document.images[uName].src = "../images/"+uName+"a.gif";
				document.getElementById(id).src = '../images/div.gif';
				document.getElementById(id+1).src = '../images/div.gif';
			}
			
		}
	}
	else
	{
		if(navRoll)
		{
		  document.images[uName].src = "../images/"+uName+uState+".gif";
		}
	}
}


function nrs(uName, uState,uImage)
{
	var elementList, i=0;
	var imgName,pos;
	navRoll = true;
	
   if(navRoll)
   {
		//alert(uName);
      document.images[uImage].src = "../images/"+uName+uState+".gif";
	 // alert(document.images[uName].src);
   }
}




function swapImage(theimage, isource)
{
      document.images[theimage].src = isource;
}
// Show/hide Detail Box

function toggle(toggleId, e)
{
	if (!e) {
		e = window.event;
	}
	if (!document.getElementById) {
		return false;
	}
	var body = document.getElementById(toggleId);
	if (!body) {
		return false;
	}	
	var im = toggleId + "_toggle";
	if (body.style.display == 'none') {
		body.style.display = 'block';
		if (document.getElementById(im)) {
			document.getElementById(im).src = "../images/rrclose.gif";
		}
	} else {
		body.style.display = 'none';
		if (document.getElementById(im)) {
			document.getElementById(im).src = "../images/rropen.gif";
		}
	}
	if (e) {
		// Stop the event from propagating, which
		// would cause the regular HREF link to
		// be followed, ruining our hard work.
		e.cancelBubble = true;
		if (e.stopPropagation) {
			e.stopPropagation();
		}
	}
}

// Pop up
function popUp(strURL,strType,strHeight,strWidth) {
	var strOptions="";
	var tlHgt=15;
	if (strType=="elastic") tlHgt=40;
	var iMyWidth =(window.screen.width / 2) - (strWidth / 2 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
	var iMyHeight =(window.screen.height /2) - (strHeight / 2 + tlHgt); //half the screen height minus half the new window height (plus title and status bars).
	if (strType=="console" || strType=="1") strOptions="resizable,height=" + strHeight + ",width=" + strWidth + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight; tlHgt=15;
	if (strType=="fixed" || strType=="2") strOptions="status=no,scrollbars=no,height=" + strHeight + ",width=" + strWidth + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight; tlHgt=15;
	if (strType=="elastic" || strType=="3") strOptions="toolbar,menubar,scrollbars,resizable,location,height=" + strHeight + ",width=" + strWidth  + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight; tlHgt=40; 
	if (strType=="console2" || strType=="4") strOptions="scrollbars=yes,height=" + strHeight + ",width=" + strWidth + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight; tlHgt=15;
	if (strType=="elastic2" || strType=="5") strOptions="toolbar=0,menubar=0,scrollbars,resizable,location=0,height=" + strHeight + ",width=" + strWidth  + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight; tlHgt=40;
	var wName = strURL.split('?')[0].replace( /[\/\.\:\#=]/g, '_' ); //Uses strURL to create unique window name for js object.
	window.open(strURL,wName,strOptions);
}

//Image Rollover
function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}

//Carrot rollovers

function mm_swapImgRestore() { //v3.0 
var i,x,a=document.mm_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
} 
function mm_preloadImages() { //v3.0 
var d=document; if(d.images){ if(!d.mm_p) d.mm_p=new Array(); 
var i,j=d.mm_p.length,a=mm_preloadImages.arguments; for(i=0; i<a.length; i++) 
if (a[i].indexOf("#")!=0){ d.mm_p[j]=new Image; d.mm_p[j++].src=a[i];}} 
} 
function mm_findObj(n, d) { //v4.0 
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=mm_findObj(n,d.layers[i].document); 
if(!x && document.getElementById) x=document.getElementById(n); return x; 
} 
function mm_swapImage() { //v3.0 

var i,j=0,x,a=mm_swapImage.arguments; document.mm_sr=new Array; for(i=0;i<(a.length-2);i+=3) 
if ((x=mm_findObj(a[i]))!=null){document.mm_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
} 


// Jump menu

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//Div switcher for Compare Vehicles page

function show( id ) { 
document.getElementById(id).style.display = 'block'; 
} 
function hide( id ) { 
document.getElementById(id).style.display = 'none'; 
} 


function shows(id) 
{ 
document.getElementById(id).style.display = 'block'; 
}

function hides(id) 
{ 
document.getElementById(id).style.display = 'none'; 
} 




function divSwap(dOn,dOff)
{
   dOn1 = document.getElementById(dOn);
   dOn2 = document.getElementById(dOff);
   dOn1.style.display = 'none';
   dOn2.style.display = 'block';
}


function flashSwap( flashDiv, flatDiv ) {
	
	detectFlash();
	if ( haveFlashVer ) { 
		document.getElementById( flatDiv ).style.display = 'none';
		document.getElementById( flatDiv ).style.height = '0px';
		document.getElementById( flashDiv ).style.display = 'block';
		document.getElementById( flashDiv ).style.height = 'auto';
	}
	else {
		document.getElementById( flashDiv ).style.display = 'none';
		document.getElementById( flashDiv ).style.height = '0px';
		document.getElementById( flatDiv ).style.display = 'block';
		document.getElementById( flatDiv ).style.height = 'auto';
	}
}

function goURL( templates )
{
	var url = null ;
	for ( var i = 0 ; i < templates.length ; i++ )
	{
		if ( templates[ i ].checked )
		{
		url = templates[ i ].value ;
		break ;
		}
	}		
	return url ;
}

function handleSubmit( templates )
{
	var href = goURL( document.forms[0].template ) ;
		if ( href != null )
		{
			document.location.href= href ;
		}
		else
		{
			alert( 'Please select an option.' ) ;
		}
	return false ;
}

// START OF Build Your Own js
var rollByo = false;
function plByo()
{
	for (i=0; i < extSwatches.length; i++) 
	{
  		eval( 'e' + mdl + '_' + extSwatches[i] + ' = new Image();' );
  		eval( 'e' + mdl + '_' + extSwatches[i] + '.src = "e' + mdl + '_' + extSwatches[i] + '.jpg";');
    }
    for (i=0; i < intSwatches.length; i++) 
	{
  		eval( 'i' + mdl + '_' + intSwatches[i] + ' = new Image();' );
  		eval( 'i' + mdl + '_' + intSwatches[i] + '.src = "i' +mdl + '_' +  intSwatches[i] + '.jpg";');
    }
   rollByo = true;
}

function rlExt(color)
{
	if (!color && rollByo)
	{
		displayDynamicText(extColorDesc,"EXT_DESC");
		document.images['select_ext'].src = eval("e" + mdl + "_" + extColor + ".src");
	}
	else if (rollByo)
	{
		for(i = 0;i< extSwatches.length;i++){
			if(extSwatches[i] ==color ){
			displayDynamicText(extSwatchesDesc[i],"EXT_DESC");
			}
		}
		document.images['select_ext'].src = eval("e" + mdl + "_" + color + ".src");
	}
}

function rlInt(color)
{
	if (!color && rollByo)
	{
		displayDynamicText(intColorDesc,"INT_DESC");
		document.images["select_int"].src = eval("i" +mdl + "_" +intColor + ".src");
	}
	else if (rollByo)
	{
	for(i = 0;i< intSwatches.length;i++){
			if(intSwatches[i] ==color ){
			displayDynamicText(intSwatchesDesc[i],"INT_DESC");
			}
		}
		document.images["select_int"].src = eval("i" +mdl + "_"+ color + ".src");
	}
}
//End of Build Your Own js

// Start functions for compare packages dropdowns

function goCompare(model, year)
{
	if (document.forms[0].packageLeft.selectedIndex == 0 || document.forms[0].packageRight.selectedIndex == 0) {
		alert('Please select two packages to compare.');
	}
	else {
		var href =	'/cadillacjsp/model/po_compare.jsp?model=' + model + '&year=' + year +
					'&packageLeft=' + document.forms[0].packageLeft.options[document.forms[0].packageLeft.selectedIndex].value +
					'&packageRight='+ document.forms[0].packageRight.options[document.forms[0].packageRight.selectedIndex].value;
		popUp(href,'elastic','630','703');
	}
}

function changeOptions(whichSelect)
{
	var otherSelect = (whichSelect == 0) ? 1 : 0;
	var currentlyOtherSelected = document.forms[0].elements[otherSelect].options[document.forms[0].elements[otherSelect].selectedIndex].value;
	var toBeRemoved = document.forms[0].elements[whichSelect].options[document.forms[0].elements[whichSelect].selectedIndex].value;
	if (toBeRemoved == 'V8 Premium Luxury Performance') { toBeRemoved = 'V8 Premium Lux. Perf.'; }
	if (currentlyOtherSelected == 'V8 Premium Luxury Performance') { currentlyOtherSelected = 'V8 Premium Lux. Perf.'; }
	var opt_count = 1;
	var array_index = 0;
	while (array_index < packages.length) {
		if (toBeRemoved != packages[array_index]) {
			if (packages[array_index] == 'V8 Premium Lux. Perf.') {
				document.forms[0].elements[otherSelect].options[opt_count] = new Option(packages[array_index], 'V8 Premium Luxury Performance');
			}
			else {
				document.forms[0].elements[otherSelect].options[opt_count] = new Option(packages[array_index], packages[array_index]);
			}
			if (packages[array_index] == currentlyOtherSelected) {
				document.forms[0].elements[otherSelect].options[opt_count].selected = true;
			}
			++opt_count;
		}
		++array_index;
	}
	document.forms[0].elements[otherSelect].options[opt_count] = null;
}

// End Functions for compare packages dropdowns

// Start functions for cpo

function cpoChangeOptions()
{	
	switch(document.changeModelYear.model.options[document.changeModelYear.model.selectedIndex].value)
	{
		case "cts":
			yearsMin = 2003;
			yearsMax = 2005;
			break;
		case "ctsv":
			yearsMin =  2004;
			yearsMax = 2005;
			break;
		case "deville":
			yearsMin =  2002;
			yearsMax = 2005;
			break;
		case "eldorado":
			yearsMin =  2002;
			yearsMax = 2002;
			break;
		case "escalade":
			yearsMin =  2002;
			yearsMax = 2005;
			break;
		case "esv":
			yearsMin =  2003;
			yearsMax = 2005;
			break;
		case "ext":
			yearsMin =  2002;
			yearsMax = 2005;
			break;
		case "seville":
			yearsMin =  2002;
			yearsMax = 2004;
			break;
		case "srx":
			yearsMin =  2004;
			yearsMax = 2005;
			break;
		case "sts":
			yearsMin =  2005;
			yearsMax = 2005;
			break;
		case "xlr":
			yearsMin =  2004;
			yearsMax = 2005;
			break;
		default:
			yearsMin = 2005;
			yearsMax = 2005;
	}

	for (i = 0; i <= document.changeModelYear.year.options.length - 1; ++i) {
		document.changeModelYear.year.options[i] = null;
	}
	document.changeModelYear.year.options[0] = new Option('-- Select Year --','');
	document.changeModelYear.year.options[0].selected = true;
	for (i = yearsMax; i >= yearsMin; --i) {
		document.changeModelYear.year.options[yearsMax - i + 1] = new Option('' + i, '' + i);
	}
}

function changeWarrantyBrand() {
	if (document.forms[0].elements[0].selectedIndex == 0) {
		return;
	}
	brands = new Array("Acura", "Audi", "BMW", "Infiniti", "Mercedes-Benz", "Lexus", "Lincoln", "Jaguar");
	selectedBrand = document.forms[0].elements[0].options[document.forms[0].elements[0].selectedIndex].value;
	for (j = 1; j <= 6; ++j) {
		for (i = 0; i < brands.length; ++i) {
			document.getElementById(brands[i]+j).style.display = 'none';
		}
		document.getElementById(selectedBrand+j).style.display = 'inline';
	}
}
function escalade2007()
{
var newWindow;
//var params = "width=776,height=785,resizable=no,menubar=yes,status=no,scrollbars=yes,toolbar=no,directories=no,location=no,top=0,left=0";
newWindow=window.open("/2007escalade/index.html","","resizable=yes,menubar=yes,status=yes,scrollbars=yes,toolbar=yes,directories=yes,location=yes,width=1000,height=840");
}
function escalade07()
{
var newWindow;
//var params = "width=776,height=785,resizable=no,menubar=yes,status=no,scrollbars=yes,toolbar=no,directories=no,location=no,top=0,left=0";
newWindow=window.open("/2007escalade/index.html","","resizable=yes,menubar=yes,status=yes,scrollbars=yes,toolbar=yes,directories=yes,location=yes,width=1000,height=840");
}
function IntellipricePop()
{
s_linkType="o"; 
s_linkName="Intelliprice";
//var params = "width=776,height=785,resizable=no,menubar=yes,status=no,scrollbars=yes,toolbar=no,directories=no,location=no,top=0,left=0";
newWindow=window.open("http://www.intelliprice.com/intellipricedealer/start.htm?dealerid=3045402","","resizable=yes,menubar=yes,status=yes,scrollbars=yes,toolbar=yes,directories=yes,location=yes");
}
function parseFile(url)
{
var filename=url.split("/");
var length=filename.length - 1;
return filename[length];

}
function PGR(mode)

{
var newWin;
if (mode=="fullscreen")
{
newWin=window.open('/vseriescollection/index.jsp?fullscreen=true', 'PGR', 'channelmode=yes,scrollbars=auto,status=no,location=no,resizable=yes,directories=no,toolbar=no');
newWin.focus();
}
else
{

newWin=window.open('/vseriescollection/index.jsp?fullscreen=false', 'PGR2', 'width=800,height=600,resizable=yes,status=yes,location=yes,menubar=yes,scrollbars=yes,directories=yes,toolbar=yes,titlebar=yes');
newWin.focus();
}
}

function wPop(url, winName, wWidth, wHeight, scrll)
{
   var scrollB;
   if(!scrll)
   {
      scrollB = 'no';
      var pWidth = wWidth;
      var rSize = 'no'
   }
   else 
   {
      scrollB = scrll;
      wWidth = parseInt(wWidth) + 20;
      var rSize = 'yes'
   }
   var iMyWidth;
   var iMyHeight;
  iMyWidth =(window.screen.width / 2) - (wWidth / 2 + 10);
   //half the screen width minus half the new window width (plus 5 pixel borders).
   iMyHeight =(window.screen.height /2) - (wHeight / 2 + 15);
   //half the screen height minus half the new window height (plus title and status bars).
   var zWin = window.open(url, winName, "status=no,width=" + wWidth + ",height=" + wHeight + ",resizable=" + rSize + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=" + scrollB);
   zWin.focus();
}

function wPopScroll(url, winName, wWidth, wHeight)
{
   	var iMyWidth;
   	var iMyHeight;
   	var rSize="yes";
   	var scrollB="yes";
  	iMyWidth =(window.screen.width / 2) - (wWidth / 2 + 10);
   	//half the screen width minus half the new window width (plus 5 pixel borders).
   	iMyHeight =(window.screen.height /2) - (wHeight / 2 + 75);
   	//half the screen height minus half the new window height (plus title and status bars).
   	var zWin = window.open(url, winName, "status=1,toolbar=1,location=1,menubar=1,width=" + wWidth + ",height=" + wHeight + ",resizable=" + rSize + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=" + scrollB);
   	zWin.focus();
}

function wallPop(model,size,number)
{
	if(!number)
   	{
     	number='1';
   	}
	wPop('wallpaper.jsp?model='+model+'&size='+size+'&number='+number,'wallpapers',800,600,'yes');
}


function switchLanguage(){
	var url = window.location.href;
	var currLang;
	var distLang;
	
	// decide which language
	if(url.indexOf('/en/GBPME/') > -1){
		// page in english section
		currLang = '/en/GBPME/';
		distLang = '/ar/GBPME/';
	}
	else if(url.indexOf('/ar/GBPME/') > -1){
		// page in arabic section
		currLang = '/ar/GBPME/';
		distLang = '/en/GBPME/';
	}
	else{
		// language is not decided redirect to website url
		window.location.href = 'http://www.cadillacarabia.com/';
	}
	
	// do the language redirection
	window.location.href = url.replace(currLang, distLang);
}// fun. switchLanguage

function inc(filename){
	var scriptTags =  document.getElementsByTagName('script');
	var isExist = false;

	var myBody = document.getElementsByTagName('body').item(0);
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';

	// find out if the new script tag exists in the file
	for(var s=0; s<scriptTags.length; ++s){
		if(scriptTags[s].src.toLowerCase() == script.src.toLowerCase()){
			isExist = true;
			break;
		}
	}
	
	// add the script tag only if not exists
	if(!isExist){
		if(myBody){
			myBody.appendChild(script);
		}
		else{
			document.appendChild(script);
		}
	}// if !isExist
	
}// fun. inc



// include Omniture js files 
// js file path should consider the HTML page folder location not this file folder location
//inc('../../../../en/GBPME/cadillac/js/s_code.js');
//inc('../../../../en/GBPME/cadillac/js/s_code_2.js');