var numeral = "-0123456789";
var all_Integers = "-0123456789";
var positive_Integers = "0123456789";
var positive_Floating_Point = ".0123456789";
var all_Floating_Point = "-.0123456789";
var hex = "0123456789abcdef";
var crrency = "$.,0123456789";
var validDomainName = "_-+0123456789abcdefghijklmnopqrstuvwxyz";
var brsString = "";
var msgString = "All websites on Cyberinvader.com is viewable on all types of browsers, but we require that you Must be running Windows 95 or later version and Micorsoft® Internet Explorer browser to enter content on our website."
var shoppingNoLongerAvailable = "This Shopping item is no longer available";

function getWinType( ){
	if(setBrowserType().toLowerCase() == "win"){
		return "&brs=" + "win";
	}
	return "";
}

function isWin() {
	var brs = setBrowserType();
	if(brs == "win"){
		return true;
	}
	return false;				
}

function getSeq( ) {
	var tm = new Date();
	var timeVal = tm.getTime();		
	return "&seq=" + timeVal;
}

function setBrowserProperties() {
	var brs = setBrowserType();
	brsString = "&brs=" + brs;
	return brs;
}

function validationfailed(url){
	window.location.href = "/" + url;	
}

function urlGetter(url){
	window.location.href = url;	
}

function bbusy() {
	buttonElement = document.getElementById('msganchor');
	var mystyle = document.getElementById("busy").style;
	mystyle.left = getOffsetLeft(buttonElement) + "px";
	mystyle.top = (getOffsetTop(buttonElement) + buttonElement.offsetHeight) + "px";
	
	if (mystyle.visibility == "hidden")	
		mystyle.visibility="visible";		
	else {
		mystyle.visibility="hidden";
	}	
}

function buildUrl( url, loc ) {
	var generalString = document.jsvalue.GeneralStringJ.value;
	var webtype = document.jsvalue.WebTypeJ.value;
	setBrowserProperties();
	var urllocation = eval("document.jsvalue." + loc + ".value");		
	return "/" + urllocation + url + webtype + brsString + generalString;	
}

function loadUrl( url, loc ) {
	var launchurl = buildUrl( url, loc );	
	window.location.href =  launchurl;
}

function getUrl( url, loc ) {
	var fieldName = document.jsvalue.ImageFieldJ.value;
	var pageName = document.jsvalue.PageNameJ.value;
	var pageSymbol = document.jsvalue.PageSymbolJ.value;
	var elementsFieldName = document.jsvalue.ElementsFieldNameJ.value;	
	var launchurl = buildUrl( url, loc );	
	var locurl = launchurl + fieldName + pageName + pageSymbol + elementsFieldName;	
	window.location.href = locurl;
}

function getCustUrl( url, loc) {
	var urllocation = eval("document.jsvalue." + loc + ".value");	
	var locurl = urllocation + url ;	
	window.location.href = "/" + locurl;
}

function showUrl( url, loc ) {	
	var launchurl = buildUrl( url, loc );
	var win = window.open (launchurl, 'windowshowUrl', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1');
	win.focus();
}

function urlLoader( url ) {	
	url = replaceSubstring( url, "<~>", "&" );
	url = replaceSubstring( url, "~ap~", "'" );

	var win = window.open (url, 'windowshowUrl', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1,resizable=1');
	win.focus();
}

function viewSite() {
	var dbpath = document.jsvalue.SiteDBJ.value;	
	var gstring = document.jsvalue.GeneralStringViewSiteJ.value;
	var dn = document.jsvalue.DomainNameJ.value;
	var url = "/" + dbpath + "/csite?openform&dn=" + dn + gstring  + getSeq();
	
	var win = window.open (url, 'windowPreViewSite', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=790,height=600');
	win.focus();
}

function viewExternalSite() {	
	var dn = document.jsvalue.DomainNameJ.value;
	var url = "";
	var win = window.open (url, 'windowPreViewSite', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=790,height=600');
	win.focus();
}

function a_viewSite( url ) {		
	var win = window.open (url, 'windowaViewSite', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=790,height=600');
	win.focus();
}

function showPage( url ) {		
	var win = window.open (url, 'windowshowpage', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=400');
	win.focus();
}

function urlDisp( url ) {		
	var win = window.open (url, 'windowUrlDisp', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=400,height=400');
	win.focus();
}

function urlHelpFull( url ) {		
	var win = window.open (url, 'windowUrlHelp', 'toolbar=1, location=1,status=1,menubar=1,scrollbars=1,resizable=1, top=50, left=500,width=750,height=670');
	win.focus();
}

function urlHelp( url ) {		
	var win = window.open (url, 'windowUrlHelp', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=750,height=670');
	win.focus();
}

function urlHelpsmall( url ) {		
	var win = window.open (url, 'windowUrlHelp', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=450,height=400');
	win.focus();
}

function helpSubject(helpKey,noHeader,size){
	var dbpath = parent.document.jsvalue.SiteDBJ.value;
	
	var sp = "";
	if( (noHeader != null) && noHeader.toLowerCase() == 'yes'){
		sp = "&noh=yes";
	}

	var url = "/" + dbpath + "/sysdocview/" + helpKey + "?opendocument" + sp;
	
	if( (size != null) && (size.toLowerCase() == 'full') ){
		parent.urlHelpFull( url );
	} else if( (size != null) && (size.toLowerCase() == 'standard') ){
		parent.urlHelp( url );
	} else {	
		parent.urlHelpsmall( url );
	}
}

function contentHelp( url ) {		
	var win = window.open (url, 'windowcontenthelp', 'toolbar=0, location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=500,height=450');
	win.focus();
}

function loadGallery( url ) { 	
	var win = window.open (url, "wind", 'resizable=yes, scrollbars=yes, toolbar=no, location=no, status=no, top=50, left=50, width=500, height=450');
	win.focus();
}

function loadUrlFull( url ) {		
	var win = window.open (url, 'windowloadurlfull');
	win.focus();
}

//validate a check box field to see if it is blank
function validateCheckBox(checkBoxName, docObj) {
	var element = docObj.elements;
	for (var i = 0; i < element.length; i++){
		if(element[i].name == checkBoxName) {
			if(element[i].checked){
				return true;
			}
		}	
	}		
	return false;
}

//check to see if any item is checked 
function isCheckBoxItemChecked(fObj) {
	if(fObj.length){
		for (var i = 0; i < fObj.length; i++){
			if(fObj[i].checked){
				return true;			
			}	
		}
	}else{
		if(fObj.checked){
			return true;
		}	
	}			
	return false;
}

//check to see if a given item value is checked 
function isItemCheckedOnCheckBox(fObj, itemString) {
	if(fObj.length){
		for (var i = 0; i < fObj.length; i++){
			if(fObj[i].checked){
				if(fObj[i].value == itemString){
					return true;			
				}
			}	
		}
	}else{
		if(fObj.checked){
			if(fObj.value == itemString){
				return true;			
			}
		}	
	}			
	return false;
}

//******* DEPLICATED ******* gets a check box field checked values - 
//This will return all checked value and 
//separate value by ":" - Index must be greater than 1
function getCheckBoxSelectedValues(fObj) {
	var selValue = "";
	for (var i = 0; i < fObj.length; i++){
		if(fObj[i].checked){
			var fdvalue = fObj[i].value;
			if(trim(selValue, " ") == ""){
				selValue = fdvalue;				
			} else {
				selValue = selValue + " : " + fdvalue;			
			}
		}	
	}		
	return selValue;
}

//gets a check box field checked values - 
//This will return all checked value and 
//return it as an array.
//passes the array object.
function getCheckBoxValues(fObj) {
	var result = [];
	var j = 0;
	result[j] = "";
	if(fObj.length){
		for (var i = 0; i < fObj.length; i++){
			if(fObj[i].checked){
				result[j] = fObj[i].value;
  				j++;
			}	
		}
	}else{
		if(fObj.checked){
			result[0] = fObj.value;
		}	
	}	
	return result;
}

//set a check box value 
//nValue is one of the values of the checkbox 
function setCheckBoxValue(fObj, nValue) {
	if( (trim(nValue, " ") != "") && (nValue != null) ){
		if(fObj.length){
			for (var i = 0; i < fObj.length; i++){
				if(fObj[i].value.toLowerCase() == nValue.toLowerCase()){
					fObj[i].checked = true;								
				}	
			}
		}else{
			fObj.checked = true;
		}	
	}
}

//set a check box value 
//nValue is one of the values of the checkbox 
function setCheckBoxTrueOrFalse(fObj, nValue, setTrueOrFale) {
	//setTrueOrFale must be true or false
	if( (trim(nValue, " ") != "") && (nValue != null) ){
		if(fObj.length){
			for (var i = 0; i < fObj.length; i++){
				if(fObj[i].value.toLowerCase() == nValue.toLowerCase()){
					fObj[i].checked = setTrueOrFale;								
				}	
			}
		}else{					
			fObj.checked = setTrueOrFale;
		}	
	}
}


//given a checkbox value, this code will clear it
//nValue is one of the values of the checkbox 
function clearCheckBoxValue(fObj, nValue) {
	if( (trim(nValue, " ") != "") && (nValue != null) ){
		if(fObj.length){
			for (var i = 0; i < fObj.length; i++){
				if(fObj[i].value.toLowerCase() == nValue.toLowerCase()){
					fObj[i].checked = false;								
				}	
			}
		}else{
			fObj.checked = false;
		}	
	}
}

//Clears all the values of a check box
function clearAllCheckBoxValues(fObj) {
	if(fObj.length){
		for (var i = 0; i < fObj.length; i++){
			if(fObj[i].checked){
				fObj[i].checked = false;								
			}	
		}
	}else{
		fObj.checked = false;
	}	
}

//Clears all the values of a check box
function setAllCheckBoxValues(fObj) {
	if(fObj.length){
		for (var i = 0; i < fObj.length; i++){
			if(!fObj[i].checked){
				fObj[i].checked = true;								
			}	
		}
	}else{
		fObj.checked = true;
	}	
}

function getComboBoxValue(fObj){
	var result = [];
	var j = 0;
	result[j] = "";	
	var opObj = fObj.options;
	if(opObj.length){
		for (var i=0; i < opObj.length; i++){
 			if (opObj[i].selected){
  				result[j] = opObj[i].value;
  				j++;
 			}
		}
	}else{
		if(opObj.selected){
			result[0] = opObj.value;
		}	
	}	
	return result;
}

function getComboBoxText(fObj){
	var result = [];
	var j = 0;
	result[j] = "";
	var opObj = fObj.options;
	if(opObj.length){
		for (var i=0; i < opObj.length; i++){
 			if (opObj[i].selected){
  				result[j] = opObj[i].text;
 				j++;
 			}
		}
	}else{
		if(opObj.selected){
			result[0] = opObj.text;
		}	
	}	
	return result;
}	

function arrayToStringValue( arrayObj ){
	var strVal = "";
	
	if(arrayObj.length){
		for (var i=0; i < arrayObj.length; i++){
 			strVal = strVal + ';' + arrayObj[i]
 			//strVal = strVal + arrayObj[i]
 		}
 		return strVal;	
	}
	return arrayObj;
} 
	
function setComboBoxValue(fObj, nValue){
	var opObj = fObj.options;
	if( (trim(nValue, " ") != "") && (nValue != null) ){
		if(opObj.length){
			for (var i=0; i < opObj.length; i++){
 				if (opObj[i].value.toLowerCase() == nValue.toLowerCase()){
  					opObj[i].selected = true;
 				}
			}
		}else{
			opObj.selected = true;
		}	
	}else{
		opObj.selected = false;
	}	
}

function isComboBoxSelected(fObj){
	var opObj = fObj.options;
	if(opObj.length){
		for (var i=0; i < opObj.length; i++){
 			if( (opObj[i].selected) && ( trim(opObj[i].value, " ") != "") ){
  				return true;
 			}
		}
	}else{
		if( (opObj.selected) && (trim(opObj[i].value, " ") != "") ){
  			return true;
 		}
	}
	
	return false;	
}

//********** DO NOT USE **** get a combo box field value
function getCheckBoxValue(checkBoxName, docObj) {
	var obj = eval("docObj." + checkBoxName);
	return obj.options[obj.options.selectedIndex].value;
}

//********** DO NOT USE **** get a combo box field Text
function getCheckBoxText(checkBoxName, docObj) {
	var obj = eval("docObj." + checkBoxName);
	return obj.options[obj.options.selectedIndex].text;	
}

//Message displayer
function msgDisp(dispString ){
	alert(dispString );
}

function gotofield( fieldObj ){	
	if( !fieldObj.name ){	
		var  fieldObj = eval("document.forms[0]." + fieldName );
	}

 	fieldObj.select();
 	fieldObj.focus();
}

function defaultField( fieldName ){
	var  fieldObj = eval("document.forms[0]." + fieldName );
	fieldObj.select();
	fieldObj.focus();
}

//validate a radio button field to see if it is blank
function validateRadioButtonField( fieldObj ){
	for (var i = 0; i < fieldObj.length; i++){
		if(fieldObj[i].checked){			
			return true;
		}		
	}	
	return false;	
}   //validateRadioButtonField() 

//returns the selected value of a radio button
function getRadioButtonSelectValue( fieldObj ){
	if(fieldObj && fieldObj.length) {
		for (var i = 0; i < fieldObj.length; i++){
			if(fieldObj[i].checked){
				return fieldObj[i].value;
			}		
		}
	} else if(fieldObj && fieldObj.value && fieldObj.checked){
		return fieldObj.value;
	}		
	return "";	
}

//returns the selected value of a radio button
function isRadioButtonSelected( fieldObj, elementValue ){
	if(fieldObj && fieldObj.length) {
		for (var i = 0; i < fieldObj.length; i++){	
			if(fieldObj[i].checked){
				if(fieldObj[i].value == elementValue){
					return true;
				}
			}		
		}
	} else if(fieldObj && fieldObj.value && fieldObj.checked){
		if(fieldObj.value == elementValue){
			return true;
		}
	}		
	return false;	
}

//set value of a radio button
//the only way I could get this to work is by passing doc.getElementsByName(field_name) as the object
function setRadioButtonSelectValue( fieldObj, nValue ){
	if(nValue != "" && nValue != null){
		if(fieldObj && fieldObj.length) {
			for (var i = 0; i < fieldObj.length; i++){
				if(fieldObj[i].value.toLowerCase() == nValue.toLowerCase()){
					fieldObj[i].checked = true;
				}		
			}
		} else if(fieldObj.value.toLowerCase() == nValue.toLowerCase()){
			fieldObj.checked = true;
		}
	}
}

function trim(myString){
	var str = myString.replace(/ /g,"");
	return str
}	

//Trim routine
//function trim(myString, st){
//	if(myString == ""){
//		return "";
//	}
	
//	for (var i = 0; i < myString.length; i++){
//		if(myString.charAt(i) != " "){
//			return myString;
//		}
//	}
//	return "";		
//}  //trim()

//Trim routine
function isTrim(myString, st){
	if(myString == ""){
		return true;
	}
	
	for (var i = 0; i < myString.length; i++){
		if(myString.charAt(i) != " "){
			return true;
		}
	}
	return true;		
}  //trim()

// CHECKS VALIDITY OF EMAIL ADDRESS - New Code
function isValidEmail( s ) {
	var str=s;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (filter.test(str)){
		return true;
	}
	return false;
}

// CHECKS VALIDITY OF EMAIL ADDRESS - Old Code
function oldisValidEmail( s ) {
 isValid = true;
 idx = 0;
 nameStr = "";
 domainStr = "";

 if (s == null) 
  isValid = false;
 else {
  nameStr = s.substring(0, s.indexOf("@"));
  domainStr = s.substring(s.indexOf("@") + 1, s.length);
  if ((s.length == 0) 
             || (nameStr.length == 0)
             || (domainStr.indexOf(".") <= 0)
             || (domainStr.indexOf("@") != -1))
   isValid = false;
  else if (!(((s.charAt(s.length - 1) >= 'a') 
                  && (s.charAt(s.length - 1) <= 'z')) 
                  || ((s.charAt(s.length - 1) >= 'A') 
                  && (s.charAt(s.length - 1) <= 'Z'))))
   isValid = false;
 } 
 return isValid; 
}  //isValidEmail()

//This function will validate a given zip code 
function zipCodeValidation( fieldValue ){
 var len = fieldValue.length;
 var CharAt = "";
 var i = 0;
 var pos = 1;

 while( pos != -1 & i < len ) {
  CharAt = fieldValue.charAt( i );
  pos = numeral.indexOf( CharAt );
 i += 1;
}
 return pos;
}

function setFieldFocus(fieldObj){
 	fieldObj.select();
 	fieldObj.focus();
} 

//verify that all characters entered are valid.
function domainNameValidation( fieldValue ){
	var len = fieldValue.length;
	var CharAt = "";
	var i = 0;
	var pos = 1;
		
	while( pos != -1  & i < len ) {
		CharAt = fieldValue.toLowerCase().charAt( i );
		pos = validDomainName.indexOf( CharAt );	
		if(pos== -1){
			return false;
		}	
		 i += 1;
	}		
	return true;
}

//validate a radio button field to see if it is blank
function validateRadioButtonField( fieldObj ){	
	for (var i = 0; i < fieldObj.length; i++){	
		if(fieldObj[i].checked){		
			return true;
		}		
	}	
	return false;	
}

// Date validation code Begins
function checkdate(objName) {
	var datefield = objName;
	if (chkdate(objName) == false) {	
		datefield.select();
	alert('The date you entered "' + datefield.value + '" is invalid.  Note the valid date format "DD/MM/YYYY". Please try again.');
		datefield.focus();
		return false;
	}else {
		return true;
   }
}

function isNumeral( fieldValue, type ){
	var len = fieldValue.length;
	fieldValue = fieldValue.toLowerCase();
	var CharAt = "";
	var i = 0;
	var pos = 1;
	var charAtCounter = 0;

	fieldValue = trim(fieldValue, ' ');
//Circles through the input data until all the data in the string is processed.
//If any invalid character is found that is not listed in the desired variable as 
//decleared above, early termination will occure and a "false" is returned.
	while( pos != -1  & i < len ) {
		CharAt = fieldValue.charAt( i );

//decides what type of number validation needs to be applied.	
	switch (type){
		case "all_Integers" :
			pos = all_Integers.toLowerCase().indexOf( CharAt );
			break;
		case "positive_Integers" :
			pos = positive_Integers.toLowerCase().indexOf( CharAt );
			break;
		case "positive_Floating_Point" :
			pos = positive_Floating_Point.toLowerCase().indexOf( CharAt );
			break;
		case "crrency" :
			pos = crrency.toLowerCase().indexOf( CharAt );
			break;	
		case "hex" :
			pos = hex.toLowerCase().indexOf( CharAt );
			break;	
		default :
			pos = all_Floating_Point.toLowerCase().indexOf( CharAt );
  			break;
	}

//checks to see that "-" only appears on the start of the data.	
	if (((CharAt == "-") || (CharAt == "$")) && (i > 0)){
		return false
	}

//checks to see that no more than one "." is entered in the number value.	
	if(CharAt == "."){
		charAtCounter += 1; 
		if(charAtCounter > 1){
			return false
		}
	} 	

	if(pos== -1){
		return false;
	}	
	 i += 1;
}	
	return true;
}

function chkdate(objName) {
	var strDatestyle = "US"; //United States date style
	//var strDatestyle = "EU";  //European date style
	var strDate;
	var strDateArray;
	var strDay;
	var strMonth;
	var strYear;
	var intday;
	var intMonth;
	var intYear;
	var pos;
	var separatorFlag = 0;
	var booFound = false;
	var datefield = objName;
	var strSeparatorArray = new Array("-"," ","/",".");
	var intElementNr = 0;
	var err = 0;
	var strMonthArray = new Array(12);
	strMonthArray[0] = "Jan";
	strMonthArray[1] = "Feb";
	strMonthArray[2] = "Mar";
	strMonthArray[3] = "Apr";
	strMonthArray[4] = "May";
	strMonthArray[5] = "Jun";
	strMonthArray[6] = "Jul";
	strMonthArray[7] = "Aug";
	strMonthArray[8] = "Sep";
	strMonthArray[9] = "Oct";
	strMonthArray[10] = "Nov";
	strMonthArray[11] = "Dec";
	strDate = datefield.value;

	if (strDate.length < 1) {
		return true;
	}

	var zeroFlag = false
	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
		pos = strDate.indexOf(strSeparatorArray[intElementNr]);

		if (pos != -1) {
			zeroFlag = true
			separatorFlag += 1; 
			strDateArray = strDate.split(strSeparatorArray[intElementNr]);
			
			if (strDateArray.length != 3) {
			
				err = 1;
				return false;
			}
			
			else {
				strDay = strDateArray[0];
				strMonth = strDateArray[1];
				strYear = strDateArray[2];
			}
			booFound = true;
		}
	}
	
	if(!zeroFlag){
		return false
	}
	
	if (strDay.length <2){
		return false;
	}
	
	if (strMonth.length  <2){
		return false;
	}
	
	if (strYear.length  <4){
		return false;
	}
	
	if (separatorFlag <1){
		return false;
	}

	if (booFound == false) {
		if (strDate.length>5) {
			strDay = strDate.substr(0, 2);
			strMonth = strDate.substr(2, 2);
			strYear = strDate.substr(4);
   		}
	}

	if((strDay.length > 2) || !(isNumeral(strDay, "positive_Integers"))){
		return false
	}

	if((strMonth.length > 2) || !(isNumeral(strMonth, "positive_Integers"))){
		return false
	}

	if((strYear.length > 4) || !(isNumeral(strYear, "positive_Integers"))){
		return false
	}

	if (strYear.length == 2) {
		strYear = '20' + strYear;
	}
	// US style
	if (strDatestyle == "US") {
		strTemp = strDay;
		strDay = strMonth;
		strMonth = strTemp;
	}
	intday = parseInt(strDay, 10);
	if (isNaN(intday)) {
		err = 2;
		return false;
	}
	
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) {
		for (i = 0;i<12;i++) {
			if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
				intMonth = i+1;
				strMonth = strMonthArray[i];
				i = 12;
   			}
		}
		if (isNaN(intMonth)) {
			err = 3;
			return false;
   		}
	}

	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) {
		err = 4;
		return false;
	}
	if (intMonth>12 || intMonth<1) {
		err = 5;
		return false;
	}

	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
		err = 6;
		return false;
	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
		err = 7;
		return false;
	}

	if (intMonth == 2) {
		if (intday < 1) {
			err = 8;
			return false;
		}
		if (LeapYear(intYear) == true) {
			if (intday > 29) {
				err = 9;
				return false;
			}
		}
		else {
			if (intday > 28) {
				err = 10;
				return false;
			}
		}
	}
	//if (strDatestyle == "US") {
	//datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
	//}
	//else {
	//datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
	//}

	return true;
}

function LeapYear(intYear) {
	if (intYear % 100 == 0) {
		if (intYear % 400 == 0) { 
			return true; 
		}
	}
	else {
		if ((intYear % 4) == 0) {
			return true; 
		}
	}
	return false;
}

function IsZipCodeValid( fieldValue ){
	var len = fieldValue.length;
	var CharAt = "";
	var i = 0;
	var pos = 1;

	while( pos != -1 & i < len ) {
		CharAt = fieldValue.charAt( i );
		pos = numeral.indexOf( CharAt );
		i += 1;
		
		if(pos == -1){
			return false;
		}	
	}			
	return true		
}

function isMemberByName(docObj, fieldName ) {
	var element = docObj.elements;
	for (var i = 0; i < element.length; i++){
		if(element[i].name == fieldName){		
			return true
		}	
	}	
	return false
}

function isMemberById(docObj, fieldName ) {
	var element = docObj.elements;
	for (var i = 0; i < element.length; i++){
		if(element[i].id == fieldName){
			return true
		}	
	}
	return false
}

function changeDName(dn) {
	var dbpath = document.jsvalue.SiteDBJ.value;	
	var gstring = document.jsvalue.GeneralStringJ.value;
	
	url = "/" + dbpath + "/changesitename?openform&dn=" + dn + gstring;
	window.location.href = url;
}

function launchSysUtility(plaunch, plaunch_multi, plaunch_none){
	var dn = document.forms[0].DomainName.value;
	var i_c = eval("document.forms[0]." + plaunch).value;

	if(parseInt(i_c) > 0 ) {
		launchPage(dn, plaunch_multi, 'SiteDBJ');
	}else{
		launchPage(dn, plaunch_none, 'SiteDBJ');
	}	
}

function launchJournalSysUtility(pn, fn, plaunch, plaunch_multi){
	var dn = document.forms[0].DomainName.value;
	var i_c = eval("document.forms[0]." + plaunch).value;
	
	if(parseInt(i_c) > 0 ) {
		launchPage(dn, plaunch_multi, 'ContentDBJ');
	}else{
		launchContentPage(pn, fn, "")		
	}	
}

function launchCustomPage(pn, fn, plaunch, plaunch_multi){
	var dn = document.forms[0].DomainName.value;
	var i_c = eval("document.forms[0]." + plaunch).value;
	if(parseInt(i_c) > 0 ) {
		launchPage(dn, plaunch_multi, 'SiteDBJ');
	}else{
		launchPage(dn, plaunch_multi, 'SiteDBJ');
		//launchContentPage(pn, fn, "")		
	}	
}


function launchInertablePanelUtility(fname){
	var dn = document.forms[0].DomainName.value;
	var dbpath = document.jsvalue.SiteDBJ.value;
	var gstring = document.jsvalue.GeneralStringJ.value;
	
	url = "/" + dbpath + "/" + fname + "?openform&pn=" + "&dn=" + dn + gstring;	
	window.location.href = url;
}

function launchUserCustomUtility(pn, fn, plaunch, plaunch_multi){
	var dn = document.forms[0].DomainName.value;
	var i_c = eval("document.forms[0]." + plaunch).value;
	if(parseInt(i_c) > 0 ) {
		launchPage(dn, plaunch_multi, 'SiteDBJ');
	}else{
		launchPage(dn, plaunch_multi, 'SiteDBJ');
		//launchContentPage(pn, fn, "")		
	}	
}

function launchEmail(){
	var dbpath = document.jsvalue.SiteDBJ.value;
	var gstring = document.jsvalue.GeneralStringJ.value;
	url = "/" + dbpath + "/emaildetail?openform" + gstring  + getSeq();
	window.location.href = url;
}

function launchShoppingDetail(){
	var dbpath = document.jsvalue.ContentDBJ.value;
	var gstring = document.jsvalue.GeneralStringJ.value;
	url = "/" + dbpath + "/shoppingdetail?openform" + gstring  + getSeq();
	window.location.href = url;
}

function getSiteManager(){
	var dbpath = document.jsvalue.MemberProfileJ.value;
	var gstring = document.jsvalue.GeneralStringJ.value;
	url = "/" + dbpath + "/" + document.jsvalue.SiteProfileFormNameJ.value + "?openform" + gstring  + getSeq();
	window.location.href = url;
}

function launchRequest(requestType){
	var dn = document.forms[0].DomainName.value;	
	launchPage(dn, 'requestdetail', 'SiteDBJ');	
}

function launchUtilityPage(dn, page, server, typeCheck) {
	if( !isWin() ){
		alert(msgString);			
	}else{
		launchPage(dn, page, server);	
	}	
}

function launchPage(dn, page, server) {	
	var dbpath = eval("document.jsvalue." + server).value;	
	var gstring = document.jsvalue.GeneralStringJ.value;
	
	url = "/" + dbpath + "/" + page + "?openform&dn=" + dn + gstring  + getSeq();
	window.location.href = url;	
}

function addPhoto(pn, pt){
	//this text is defined in the richtext library
	if(parent.document.forms[0].EditorFlag.value == "1"){
		alert(functionalityMsg);
		return;
	}

	var dbpath = document.jsvalue.SiteDBJ.value;
	var gstring = document.jsvalue.GeneralStringJ.value;
	url = "/" + dbpath + "/pagephoto?openform&pn=" + pn + "&pt=" + pt + gstring  + getSeq();
	window.location.href = url;
}

function launchCustomImage(np) {
	//this text is defined in the richtext library
	if(parent.document.forms[0].EditorFlag.value == "1"){
		alert(functionalityMsg);
		return;
	}
	
	var pth = document.jsvalue.ILibraryDBJ.value;
	var globalString = document.jsvalue.GeneralStringJ.value;
	var pn = document.forms[0].PName.value;
	var pt = document.forms[0].FieldName.value;
	
	setBrowserProperties();	
	
	if((np != null) && (np == 'np')){
		var fn = "cimagepopupnp";
		var ht = '610'		
	}else{
		fn = "cimagepopup";	
		var ht = '610'
	}
	var gString = globalString + brsString + "&pn=" + pn + "&pt=" + pt + "&start=1" + "&count=2";
	var url = "/" + pth + "/" + fn + "?open" + gString + getSeq();

//	window.location.href = url;
	var w = window.open (url, 'windowcyberimage', 'resizable=no, scrollbars=no, toolbar=no, location=no, status=yes, top=50, left=50, width=580, height=' + ht);
	w.opener = self;
	w.focus();
}

function launchBGImage(fn, left, top, width, height) {
	//this text is defined in the richtext library
	if(parent.document.forms[0].EditorFlag.value == "1"){
		alert(functionalityMsg);
		return;
	}
	
	var pth = document.jsvalue.ILibraryDBJ.value;
	var globalString = document.jsvalue.GeneralStringJ.value;
		
	setBrowserProperties();	
		
	var gString = globalString + brsString;
	var url = "/" + pth + "/" + fn + "?open" + gString + getSeq();

//	window.location.href = url;
	var w = window.open (url, 'windowbgimage', 'resizable=no, scrollbars=no, toolbar=no, location=no, status=yes, top=' + top + ', left=' + left + ', width=' + width + ', height=' + height);
	w.opener = self;
	w.focus();
}

function getBGImage(fn, left, top, width, height) {
	var pth = document.jsvalue.ILibraryDBJ.value;
	var globalString = document.jsvalue.GeneralStringJ.value;
		
	setBrowserProperties();	
		
	var gString = globalString + brsString;
	var url = "/" + pth + "/" + fn + "?open" + gString + getSeq();

//	window.location.href = url;
	var w = window.open (url, 'windowbgimage', 'resizable=no, scrollbars=no, toolbar=no, location=no, status=yes, top=' + top + ', left=' + left + ', width=' + width + ', height=' + height);
	w.opener = self;
	w.focus();
}

function launchUpload( pop, launchType ) {
	var pth = document.jsvalue.ILibraryDBJ.value;
	var globalString = document.jsvalue.GeneralStringJ.value;
	var pn = document.forms[0].PName.value;
	var pt = document.forms[0].FieldName.value;
	setBrowserProperties();
	
	if((document.forms[0].NewGallery) && (launchType == "photogallery" || launchType == "photogallery1" || launchType == "photogallery2" || launchType == "photogallery3" || launchType == "photogallery4" || launchType == "photogallery5")){	
	//if(pop == "addphotogallery"){	
		var newgallery = document.forms[0].NewGallery.value;
		if(newgallery == "yes"){
			if(!confirm("If you have made changes to your content above, make sure they are saved before continuing upload photo to your Photo Gallery. Press Ok if you wish to continue.")) {
				return;
			}
		}
	}
	
	if(pop == "" || pop == null){		
		pop = "pagephoto";
	}	
	
	if(launchType == "" || launchType == null){		
		launchType = "";
	}
	
	if(launchType == "pgtheme"){		
		pt = "pgtheme"
	}

	var gString = globalString + brsString + "&pn=" + pn + "&pt=" + pt + "&ltype=new";
	var url = "/" + pth + "/" + pop + "?open" + gString + getSeq();

	if(launchType.toLowerCase() == "trad"){
		var w = window.open (url, 'windowfileuploadtrad', 'resizable=no, scrollbars=no, toolbar=no, location=no, status=yes, top=50, left=50, width=535, height=380');
	}else if(launchType.toLowerCase() == "short"){
		var w = window.open (url, 'windowfileuploadshort', 'resizable=no, scrollbars=no, toolbar=no, location=no, status=yes, top=50, left=50, width=335, height=380');
	}else if(launchType.toLowerCase() == "photogallery" || launchType.toLowerCase() == "photogallery1" || launchType.toLowerCase() == "photogallery2" || launchType.toLowerCase() == "photogallery3" || launchType.toLowerCase() == "photogallery4" || launchType.toLowerCase() == "photogallery5"){
		var w = window.open (url, 'windowfileuploadshort', 'resizable=no, scrollbars=no, toolbar=no, location=no, status=yes, top=50, left=50, width=335, height=415');		
	}else if( (launchType.toLowerCase() == "bgcolor") || (launchType.toLowerCase() == "teaser1") || (launchType.toLowerCase() == "teaser2") ){
		var w = window.open (url, 'windowfileuploadbgcolor', 'resizable=no, scrollbars=yes, toolbar=no, location=no, status=yes, top=50, left=50, width=595, height=520');
	}else if(launchType.toLowerCase() == "logo"){
		var w = window.open (url, 'fileuploadwindowtrad', 'resizable=no, scrollbars=yes, toolbar=no, location=no, status=yes, top=50, left=50, width=595 height=520');
	}else if(launchType.toLowerCase() == "photonoproperties"){
		var w = window.open (url, 'windowphotonoproperties', 'resizable=no, scrollbars=yes, toolbar=no, location=no, status=yes, top=50, left=50, width=595, height=520');
	}else{
		var w = window.open (url, 'windowfileupload', 'resizable=no, scrollbars=yes, toolbar=no, location=no, status=yes, top=50, left=50, width=595, height=520');
	}
	
	w.opener = self;
	w.focus();
}

function loadPhotoCust(imgUrl) {
	loadPhoto(imgUrl, '');
}

function loadBackgroundImage(imgUrl, upload) {
	var parentWindow = window.opener;	
	var pgSymbol = document.forms[0].PgSymbol.value;
					
	if (window.opener && !window.opener.closed){
		if(parentWindow.document.forms[0].PgSymbol && parentWindow.document.forms[0].PgSymbol.value == "bgtexture"){
			pgSymbol = parentWindow.document.forms[0].PgSymbol.value
			parentWindow.processColorValue(imgUrl, pgSymbol);
			parentWindow.focus();
			window.close();
			return;
		} 
		
		parentWindow.document.forms[0].ImageUrlVal.value = imgUrl;
		popupPhoto(imgUrl, "", "", "", "", "", pgSymbol, upload);
	}			
}

function loadPhoto(imgUrl, upload) {
	var parentWindow = window.opener;
	var alignment = document.forms[0].Alignment.value;
	var style = document.forms[0].Style.value;
	var border = document.forms[0].Border.value;
	var width = document.forms[0].Width.value;
	var height = document.forms[0].Height.value;
	var pgSymbol = document.forms[0].PgSymbol.value;	
	
	if (window.opener && !window.opener.closed){
		parentWindow.document.forms[0].ImageUrlVal.value = imgUrl;
		popupPhoto(imgUrl, alignment, style, border, width, height, pgSymbol, upload);
	}else{
		alert("The window you were editing is no longer available")
	}			
}

function loadPhotoNoProperties(imgUrl, upload) {
	var parentWindow = window.opener;	
	var pgSymbol = document.forms[0].PgSymbol.value;	

	if (window.opener && !window.opener.closed){
		parentWindow.document.forms[0].ImageUrlVal.value = imgUrl;
		popupPhoto(imgUrl, null, null, null, null, null, pgSymbol, upload);
	}			
}

function setBgProperties(){	
	var repeat = parent.document.forms[0].Repeat.options[document.forms[0].Repeat.options.selectedIndex].value;
	var position = parent.document.forms[0].Position.options[document.forms[0].Position.options.selectedIndex].value;
	var attachment = parent.document.forms[0].Attachment.options[document.forms[0].Attachment.options.selectedIndex].value;
	
	setBackgroundProperties(repeat, position, attachment);	
}

function getImagUrl(imgUrl, idpImageKey){

	if(document.getElementById('picimg')){
		var picdoc = document.getElementById('picimg');
		
		if(picdoc.style.visibility == "hidden"){
			picdoc.style.visibility = "visible";
		}
	}
	
	if(document.getElementById('loadimg')){
		var imgobj = document.getElementById('loadimg');							
		imgobj.src = imgUrl;
		document.forms[0].ImageUrl.value = imgUrl
		document.forms[0].IDPImageKey.value = idpImageKey
	}		
}

function rateJournal(dd, rb){	
	var pth = document.jsvalue.MemberProfileJ.value;
	var pageDefination = document.pgdefination.PageDefinationVal.value;
	var rating = getRadioButtonSelectValue( eval("document.pgdefination." + rb) ); 	
	if(rating == ""){
		alert("Please select rating before clicking Rate");
	}else{
		var url = "/" + pth + "/LoadURL?openagent&action=processjournalRating&vto=csite&dd=" + dd + pageDefination + "&r=" + rating;
		window.location.href = url;
	}	
}

function linksColor(id){
	var linkcolor = document.forms[0].LinkersColor.value;
	if(document.getElementById(id)){
		var linkobj = document.getElementById(id);
		linkobj.style.color = linkcolor;										
	}		
}

function hoverColor(id){
	var hovercolor = document.forms[0].HoversColor.value;
	if(document.getElementById(id)){
		var linkobj = document.getElementById(id);
		linkobj.style.color = hovercolor;										
	}		
}

function click(){
	alert('This is just a sample to show how your link and hover colors will look link on your website. Please click ok to continue.')
}

function elink(unid) {
	var dbpath = document.jsvalue.ILibraryDBJ.value;
	var properties = document.forms[0].PageDefinationVal.value;

	var url = "/" + dbpath + "/pgalleryed?openform&unid=" + unid + properties
	var w = window.open (url, 'windowfileuploadshort', 'resizable=no, scrollbars=no, toolbar=no, location=no, status=yes, top=200, left=100, width=335, height=220');	
	w.opener = self;
	w.focus();
}

function rlink(unid) {
	if (confirm("You are about to delete this photo from your photo gallery. Would you like to continue?")){ 	
		var dbpath = document.jsvalue.MemberProfileJ.value;
		var properties = document.forms[0].PageDefinationVal.value;
		var action = "&action=removephotogallery&vto=photogalleryuser"
		var url = "/" + dbpath + "/LoadUrl?openagent&unid=" + unid + properties + action
		window.location.href = url;
	}
}

function rblog(unid) {	
	if (confirm("You are about to remove this blog/journal. Would you like to continue?")){ 					
		var dbpath = document.jsvalue.SiteDBJ.value;
		var gString = document.jsvalue.GeneralStringJ.value;
		var url = "/" + dbpath + "/ProcessJournal?openagent&unid=" + unid + gString + getSeq();
		window.location.href = url;
	}
}

function searchUsers(){
	var pth = document.jsvalue.SiteDBJ.value;
	var globalString = document.jsvalue.GeneralStringJ.value;
	var pn = document.forms[0].PName.value;
	var pt = document.forms[0].FieldName.value;
	
	var gString = globalString + brsString + "&pn=" + pn + "&pt=" + pt ;
	var url = "/" + pth + "/searchusers?open" + gString + getSeq();
	
	var w = window.open (url, 'windowsearch', 'resizable=no, scrollbars=yes, toolbar=no, location=no, status=no, top=50, left=50, width=325, height=400')	
	w.focus();
}

function setSearcName( dname ){
	var parentWindow = window.opener;	
	
	if (window.opener && !window.opener.closed){
		parentWindow.document.forms[0].DomNames.value = dname;
	}
	parentWindow.focus();
	window.close();	
}

function removeImgItem() {	
	var imgdata = document.forms[0].ImageUrlVal.value;
	if(trim(imgdata, " ") != ""){
		if (confirm("Are you sure you want to remove your profile image? To continue, press Ok")){ 	
			if(document.getElementById("img")){
				var imgObj = document.getElementById("img");
				imgObj.src = "/icons/ecblank.gif"	
				document.forms[0].ImageUrlVal.value = "";									
			}	
		}	
	}	
}

function editfavorites( unid, linkType ){ 
	var url = "";	
	var dbpath = document.jsvalue.SiteDBJ.value;
	var gString = document.jsvalue.GeneralStringJ.value;
	
	if(linkType == "internal"){	
		url = "/" + dbpath + "/favoritesinternal?openform&unid=" + unid + gString + getSeq();
	} else {
		url = "/" + dbpath + "/favoritesexternal?openform&unid=" + unid + gString + getSeq();
	}
	
	window.location.href = url;
}

function removefavorites( unid ){ 
	if (confirm("You have selected to permanently remove this link/favorite. To continue, press \"OK\" or \"Cancel\" to stop.")){
		var url = "";	
		var dbpath = document.jsvalue.SiteDBJ.value;
		var gString = document.jsvalue.GeneralStringJ.value;
	
		url = "/" + dbpath + "/ProcessFavorites?open&unid=" + unid + gString + getSeq();	
		window.location.href = url;
	}
}

function removerequest( unid, ut ){ 
				
	if (confirm("You have selected to permanently remove this " + ut + ". To continue, press \"OK\" or \"Cancel\" to stop.")){
		var url = "";	
		var dbpath = document.jsvalue.SiteDBJ.value;
		var ut = document.jsvalue.UserType.value;		
		var gString = document.jsvalue.GeneralStringJ.value;
	
		url = "/" + dbpath + "/ProcessRequest?open&unid=" + unid + "&ut=" + ut + gString + getSeq();	
		window.location.href = url;
	}
}

function allUtility(linktype, unid){
	var url = "";
	var dbpath = document.jsvalue.ILibraryDBJ.value;
	var gstring = document.jsvalue.GeneralStringJ.value;
	var unid = "&unid=" + unid;
	if(linktype == "internal"){	
		url ="/" + dbpath + "/favoritesinternal?openform" + gstring + unid;
		var win = window.open (url, 'windowfavorite1', 'toolbar=0,location=0,status=0,top=300,left=300,menubar=0,scrollbars=0,resizable=0,width=450,height=150');
		win.focus();
	} else {	
		url ="/" + dbpath + "/favoritesexternal?openform" + gstring + unid;
	var win = window.open (url, 'windowfavorite2', 'toolbar=0,location=0,status=0,top=300,left=300,menubar=0,scrollbars=0,resizable=0,width=450,height=280');
	win.focus();
	}
}

function alertUser(){
	alert("To continue, your temporary password needs to be updated. Please enter a password you would remember. Keep this password secret to yourself."); 
}

function launchUserProfile(){
	var codetype = document.forms[0].CodeTypeUserProfileD.value;
	var dbpath = document.jsvalue.MemberProfileJ.value;
	var gString = document.jsvalue.GeneralStringJ.value;

	var url = "/" + dbpath + "/0/" + codetype + "?open" + gString + getSeq();
	window.location.href = url;
}

function readrequest( unid, rtype, loc ){ 	
	var sdbpath = document.jsvalue.SiteDBJ.value;
	var gString = document.jsvalue.GeneralStringJ.value;
	
	var url = "/" + sdbpath + "/requestview?open&rtype=" + rtype + "&unid=" + unid + gString + getSeq();
	var win = window.open (url, 'windowreadrequest', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=550,height=350');
	win.focus();
}

function readCustomRequest( unid, sp ){ 	
	var dbpath = document.jsvalue.ContentDBJ.value;
	var gString = document.jsvalue.GeneralStringJ.value;

	var url = "/" + dbpath + "/0/" + unid + "?open" + gString + getSeq();
	var win = window.open (url, 'windowreadrequest', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=550,height=600');
	win.focus();
}

function loadLfeel(customtype){
	var dbpath = document.jsvalue.MemberProfileJ.value;
	var gstring = document.jsvalue.GeneralStringJ.value;
	var st = document.forms[0].StVal.value;

	var st_v = "";
	if(trim(st, " ", "") != ""){
		st_v = "&st=" + st;
	}
	url = "/" + dbpath + "/lookingfeelitemselection?openform&custtype=" + customtype + st_v + gstring;
	window.location.href = url;	
}	

function addMusicFile(){
	var dbpath = document.jsvalue.SiteDBJ.value;
	var gstring = document.jsvalue.GeneralStringJ.value;
		
	url = "/" + dbpath + "/musicprofile?openform" + gstring;
	window.location.href = url;	
}

function loadSearch( unid ){ 	
	var dbpath = document.jsvalue.SiteDBJ.value;
	var gString = document.jsvalue.GeneralStringJ.value;

	var url = "/" + dbpath + "/searchview/" + unid + "?open" + gString + getSeq();
	window.location.href = url;
}

function isValidImage(iUrl){
	var iStr = iUrl.toLowerCase();
	var l = iStr.length;	
	if((iStr.substring((l - 4), l) != ".gif") && (iStr.substring((l - 4), l) != ".jpg") && (iStr.substring((l - 4), l) != ".png") ){	
		return false;
	}
	return true;	
}

function isValidBGMusic(mUrl){
	var mStr = mUrl.toLowerCase();
	var l = mStr.length;
	if((mStr.substring((l - 7), l).toLowerCase() != "http://") && (mStr.substring((l - 4), l) != ".mid") && (mStr.substring((l - 4), l) != ".aif") && (mStr.substring((l - 5), l) != ".aifc") && (mStr.substring((l - 5), l) != ".aiff") && (mStr.substring((l - 3), l) != ".au") && (mStr.substring((l - 4), l) != ".snd") && (mStr.substring((l - 4), l) != ".mp3") && (mStr.substring((l - 4), l) != ".asf") && (mStr.substring((l - 4), l) != ".wav")&&(mStr.substring((l - 5), l) != ".mpeg")&&(mStr.substring((l - 4), l) != ".mpg") && (mStr.substring((l - 4), l) != ".avi") && (mStr.substring((l - 4), l) != ".mpe") && (mStr.substring((l - 4), l) != ".wma") && (mStr.substring((l - 4), l) != ".wmv") && (mStr.substring((l - 4), l) != ".asx") && (mStr.substring((l - 4), l) != ".wax") && (mStr.substring((l - 3), l) != ".wm") && (mStr.substring((l - 4), l) != ".wvx") && (mStr.substring((l - 4), l) != ".m1v") && (mStr.substring((l - 4), l) != ".m3u") && (mStr.substring((l - 4), l) != ".mpa") && (mStr.substring((l - 4), l) != ".swf") && (mStr.substring((l - 4), l) != ".ivf") ){									
		return false;
	}
	return true		
}

function launchNewSiteProfile(url){
	window.location.href = url;
}

function launchWebSamples(webType){
	var dbpath = document.jsvalue.MemberProfileJ.value;
	var gString = document.jsvalue.GeneralStringJ.value;
	var st = "&st=" + webType;	
	var url = "/" + dbpath + "/sampledetail" + "?open" + st + gString + getSeq();
		
	window.location.href = url;					
}

function launchSampleSelection(){
	var dbpath = document.jsvalue.MemberProfileJ.value;
	var gString = document.jsvalue.GeneralStringJ.value;

	var url = "/" + dbpath + "/samplesite?open" + gString + getSeq();
	window.location.href = url;		
}

function userLaunchLink(urlproperties, htype){

	var pageUrl = document.jsvalue.PageUrlUserJ.value;	
	var currentBlogPageTitle = document.jsvalue.BlogPageTitleJ.value;
	
	var pt = queryString(urlproperties, "pt=");
	if(pt.toLowerCase() == "tblog"){
		urlproperties = "&pn=" + replaceSubstring(currentBlogPageTitle, " ", "+") + urlproperties;
	}
	
	var url = pageUrl + urlproperties;
	window.location.href = getWWWDomain(htype) + url;		
}

function seeDetail(urlproperties){
	var dbpath = document.jsvalue.ContentDBJ.value;
	var gstring = document.jsvalue.StringBuilderSiteJ.value;
	
	var url = "/" + dbpath + "/seedetail?openagent" + urlproperties + gstring;
	window.location.href = url;		
}


function launchShoppingLink(urlproperties){
	var dbpath = document.jsvalue.ContentDBJ.value;
	var gstring = document.jsvalue.StringBuilderSiteJ.value;
	
	var url = "/" + dbpath + "/ShoppingLoadLink?open" + urlproperties + gstring;
	window.location.href = url;	
}

function launchShoppingLinkxxxxx(urlproperties, htype){
	var enableShopping = document.jsvalue.EnableShoppingJ.value;
	if(enableShopping != "yes"){
		alert(shoppingNoLongerAvailable); 
		return;
	}
	var pageUrl = document.jsvalue.PageUrlUserJ.value;		
	var url = pageUrl + urlproperties;
	window.location.href = getWWWDomain(htype) + url;		
}

function shoppingUserLaunchLink(urlproperties, htype){
	var pageUrl = document.jsvalue.PageUrlUserJ.value;
	var categoryString = document.jsvalue.ShoppingCategoryJ.value;
	var categorySize = document.jsvalue.ShoppingCategorySizeJ.value;
			
	var k = queryString(urlproperties, "&k=");
	var pt = queryString(urlproperties, "&pt=");
	var fn = queryString(urlproperties, "&fn=");	
			
	var kString = "&k=" + k;
	var ptString = "&pt=" + pt;	
	
	var knum = countStringItem(urlproperties, "&k=")
	
	if( (fn.toLowerCase() == "shopping") && (categorySize < 2) ){
		categoryString = replaceSubstring(categoryString, " ", "+")	
		urlproperties = replaceSubstring(urlproperties, ptString, "&pt=shop");
		
		if(knum > 0){
			urlproperties = replaceSubstring(urlproperties, kString, "&k=" + categoryString);
		}else{
			urlproperties = urlproperties + "&k=" + categoryString;
		}
		
	}else if( (fn.toLowerCase() == "shopping") && (categorySize > 1) ){
		urlproperties = replaceSubstring(urlproperties, ptString, "&pt=cat");
		urlproperties = replaceSubstring(urlproperties, kString, "");	
	}
	
	var url = pageUrl + urlproperties;
	window.location.href = getWWWDomain(htype) + url;		
}

function userLaunchDialogLink(urlproperties){
	var dbpath = document.jsvalue.SiteDBJ.value;
	var gString = document.jsvalue.StringBuilderSiteJ.value;
	
	x = screen.availWidth * 0.10;
	y = screen.availHeight * 0.05;

	var url = "/" + dbpath + "/detailsmall?open&" + urlproperties + gString + getSeq();
	
	var win = window.open (url, 'windowmenudetailsmall', 'toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=0,top=' + y + ',left=' + x + ',width=450,height=350');
	win.focus();	
}

function newWindowLaunchLink( urlproperties, htype) {
	var pageUrl = document.jsvalue.PageUrlUserJ.value;
	var url = pageUrl + urlproperties;
	var win = window.open (getWWWDomain(htype) + url, 'newwindowLaunch');
	win.focus();
}

function play(list) {
	if (playstate == 2) {
		document.darkplayer.Play();
	} else {
		var snum = list.options[list.selectedIndex].value
		document.darkplayer.FileName = songs[snum];
		document.darkplayer.scr = songs[snum];
	}
	playstate = 1;
}

function loadMediaValue(){
	var mplayer = document.getElementById("mplayer");	
	var autoStart = document.jsvalue.AutoStartJ.value;	

	if(autoStart == "0"){
		autoStart = 0;
	}else{
		autoStart = 1;
	}
		
	if(mplayer){	
		var url = mplayer.src;
		if(url != null) {
			mplayer.FileName = url;
			mplayer.scr = url;
			mplayer.AutoStart = autoStart;
			mplayer.ShowStatusBar = true;
			mplayer.BufferingTime = "10";
			mplayer.play();
		}
	}	    
}

function addMenuIconPage(){
	//this text is defined in the richtext library
	if(parent.document.forms[0].EditorFlag.value == "1"){
		alert(functionalityMsg);
		return;
	}
	
	var dbpath = document.jsvalue.ILibraryDBJ.value;
	var gString = document.jsvalue.GeneralStringJ.value;
	
	var url = "/" + dbpath + "/pagemenuiconpopup?open&" + gString + getSeq();
	
	var win = window.open (url, 'windowmenuicon', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=450,height=350');
	win.focus();
}

function loadMenuIcon(fieldName, iconTag) {
	var dbpath = document.jsvalue.ILibraryDBJ.value;
	var iconData = eval("document.forms[0].D" + fieldName).value;
	var gString = document.jsvalue.GeneralStringJ.value;
	
	var url = "/" + dbpath + "/menuiconpopup?open&fn=" + fieldName + iconData + "&icontag=" + iconTag + gString + getSeq();
	
	var win = window.open (url, 'windowmenuicon', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=450,height=350');
	win.focus();
}

function clearIconImg(fieldName, msg) {
	var dbpath = parent.document.jsvalue.ILibraryDBJ.value;

	var imgUrl = "/" + dbpath + "/ecblank.gif";
	var imgProp = "";
				
	if(confirm(msg)) {	
		var mydoc = document.getElementById(fieldName);			
		if(mydoc){
			mydoc.src = imgUrl;
			eval("document.forms[0]." + "D" + fieldName).value = "&iconname=&iconkey=";
		}					
	}	
}

function scrollToLoc(){
	dh=document.body.scrollHeight
	ch=document.body.clientHeight
	if(dh>ch){
		moveToLoc = (dh-ch)/2;
		window.scrollTo(0,moveToLoc);
	}
}

function launchBg(blogval){
	//var i_c = document.forms[0].JournalCountVal.value;
	var v_c = document.forms[0].BlogVal.value;
	
	if(v_c == "" ||  v_c == null) {
		launchContentPage('Blog/Journal', 'blog', '', '');	
	}else{
		launchContentPage('Blog/Journal', 'blog', 'yes', v_c);
	}
}

function launchMediaLink( mlink ){
	var dbpath = document.jsvalue.ILibraryDBJ.value;	
	var gString = document.jsvalue.GeneralStringJ.value;
	var dn = document.jsvalue.DomainNameJ.value;
	
	var url = "/" + dbpath + "/launchmedialink?open&url=" + mlink + "&dn=" + dn + gString;
	var win = window.open (url, 'windowmedia', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,top=200,left=200,width=654,height=480');
	win.focus();
}

function setBGTexture(url, id){
	var myimg = document.getElementById(id);
	if(myimg){
		myimg.style.backgroundImage = "url('" + url + "')";
		document.forms[0].ImageUrl.value = url;
	}
}

function setBorderOver(id){
	var myimg = document.getElementById(id);	
	if(myimg){
		myimg.style.borderStyle = "solid";
		myimg.style.borderWidth = "1px";		
		myimg.style.borderColor = "#FF0000";		
	}
}

function setBorderOut(id){
	var myimg = document.getElementById(id);	
	if(myimg){		
		myimg.style.borderStyle = "solid";
		myimg.style.borderWidth = "1px";		
		myimg.style.borderColor = "#000080";		
	}
}

function getNavPage(fn, start, txtype){
	var pth = document.jsvalue.ILibraryDBJ.value;
	var globalString = document.jsvalue.GeneralStringJ.value;
	
	var gString = globalString + brsString + "&start=" + start + "&txtype=" + txtype;
	var url = "/" + pth + "/" + fn + "?open" + gString + getSeq();	
	window.location.href = url;	
}

function replaceSubstring(input, searchString, replaceString) {
// Goes through the input and replaces all occurrence of the searcString String and replaces with replaceString.
//By Felix Odiase(cyberinvader.com) 
	var pos = 0;
   	var lenInput = input.length;
  	var lenSearchString = searchString.length;
	var newString = input;  	
  	  
  	pos = input.toLowerCase().indexOf(searchString.toLowerCase()); 
  	newString = input;
  	while(pos > -1){  		   	  		  			  			
  		leftString = newString.substring(0, pos);
  		var startString = pos + lenSearchString; 		
  		rightString = newString.substring(startString, lenInput);  		 		
		newString = leftString + replaceString + rightString; 	
		pos = newString.toLowerCase().indexOf(searchString.toLowerCase(), (startString + 1));   		  	
	}
  	return newString;
}

//splits the elements by the separator and parse them in an array. Request 1 if you would like the left element on the left side or 2 for the right element of the separator.
//if and empty string is pased, a "" string is returned.
function word(str, sep, num){	
	if((trim(str, " ") != "") && (trim(sep, " ") != "") && (isNumeral( String(num), positive_Integers ))){
		var splitArray = str.split(sep);
		if((num > 0) && (num <= splitArray.length) ){
			return splitArray[num - 1];
		}
	}
	return "";
}

function explode(str, sep){
	return str.split(sep);	
}

function implode(strArray, sep){
	var comStr = "";

	for (var i = 0; i < strArray.length; i++){	
		if(trim(comStr, " ") == ""){
			comStr = strArray[i];
		}else{
			comStr = comStr + sep + strArray[i];
		}
	}
	return comStr;	
}

function UtilityFormatAny(str, searchKey, replaceItem){
	var searchString = eval('/' + searchKey + '/ig'); 
	return tmpstring = str.replace(searchString, replaceItem);	
}

function setPaypal() {
	for (var i = 0; i < 20; i++) {
		var paypal_id = "paypal" + i;
		var obj = document.getElementById(paypal_id);
		if(obj){
			var ppal = eval("paypal" + i);
			obj.innerHTML = ppal;										
		}
	}
}

function getWWWDomain(htype){

	var dUrl = "";
	var wwwDName = document.jsvalue.WWWJ.value;
	var dName = document.jsvalue.DefWWWJ.value;
	
	if((htype == "https") && (trim(wwwDName, " ") != "")){
		dUrl = wwwDName;
	} else if((htype == "") && (trim(wwwDName, " ") != "")) {
		dUrl = dName;
	} else {
		dUrl = "";
	}
	
	return dUrl;
}


function checkCardNumWithMod10(cardNum) {
	var i;
	var cc = new Array(16);
	var checksum = 0;
	var validcc;

	// assign each digit of the card number to a space in the array	
	for (i = 0; i < cardNum.length; i++) {
		cc[i] = Math.floor(cardNum.substring(i, i+1));
	}

	// walk through every other digit doing our magic
	// if the card number is sixteen digits then start at the
	// first digit (position 0), otherwise start from the
	// second (position 1)
	for (i = (cardNum.length % 2); i < cardNum.length; i+=2) {
		var a = cc[i] * 2;
		if (a >= 10) {
			var aStr = a.toString();
			var b = aStr.substring(0,1);
			var c = aStr.substring(1,2);
			cc[i] = Math.floor(b) + Math.floor(c);
		} else {
			cc[i] = a;
		}
	}

	// add up all of the digits in the array
	for (i = 0; i < cardNum.length; i++) {
		checksum += Math.floor(cc[i]);
	}

	// if the checksum is evenly divisble by 10
	// then this is a valid card number
	validcc = ((checksum % 10) == 0);

	return validcc;
}

function cleanCardNum(cardNum) {
	var i;
	var ch;
	var newCard = "";

	// walk through the string character by character to build
	// a new string with numbers only
	i = 0;
	while (i < cardNum.length) {
		// get the current character
		ch = cardNum.substring(i, i+1);
		if ((ch >= "0") && (ch <= "9")) {
			// if the current character is a digit then add it
			// to the numbers-only string we're building
			newCard += ch;
		} else {
			// not a digit, so check if its a dash or a space
			if ((ch != " ") && (ch != "-")) {
				// not a dash or a space so fail
				alert("The card number contains invalid characters.");
				return "";
			}
		}
		i++;
	}

	// we got here if we didn't fail, so return what we built
	return newCard;
}

function checkCard(cardType, cardNum) {
	var validCard;
	var cardLength;
	var cardLengthOK;
	var cardStart;
	var cardStartOK;
	
	// check if the card type is valid
	if ((cardType != "V") && (cardType != "M") && (cardType != "A") && (cardType != "D")) {
		alert("Please select a card type.");
		return false;
	}

	// clean up any spaces or dashes in the card number
	validCard = cleanCardNum(cardNum);
	if (validCard != "") {
		// check the first digit to see if it matches the card type
		cardStart = validCard.substring(0,1);
		cardStartOK = ( ((cardType == "V") && (cardStart == "4")) ||
				((cardType == "M") && (cardStart == "5")) ||
				((cardType == "A") && (cardStart == "3")) ||
				((cardType == "D") && (cardStart == "6")) );
		if (!(cardStartOK)) {
			// card number's first digit doesn't match card type
			alert("Please make sure the card number you've entered matched the card type you selected.");
			return false;
		}

		// the card number is good now, so check to make sure
		// it's a the right length
		cardLength = validCard.length;		
		cardLengthOK = ( ((cardType == "V") && ((cardLength == 13) || (cardLength == 16))) ||
				 ((cardType == "M") && (cardLength == 16)) ||
				 ((cardType == "A") && (cardLength == 15)) ||
				 ((cardType == "D") && (cardLength == 16)) );
		if (!(cardLengthOK)) {
			// not the right length
			alert("Please make sure you've entered all of the digits on your card.");
			return false;
		}

		// card number seems OK so do the Mod10
		if (checkCardNumWithMod10(validCard)) {
			return true;
		} else {
			alert("Please make sure you've entered your card number correctly.");
			return false;
		}
	} else {
		return false;
	}
}

function isExpired( month, year ) {	
	var now = new Date();							// this function is designed to be Y2K compliant.
	var expiresIn = new Date(year,month,0,0,0);		// create an expired on date object with valid thru expiration date
	expiresIn.setMonth(expiresIn.getMonth()+1);		// adjust the month, to first day, hour, minute & second of expired month
	if( now.getTime() < expiresIn.getTime() ) return false;
		return true;									// then we get the miliseconds, and do a long integer comparison
}

function countStringItem(searchStr, searchItem) {
// Goes through a given string and counts the number of occurance of a given string or character item.
//By Felix Odiase(cyberinvader.com) 
	var r_String = searchStr;
	var lenSearchItem = searchItem.length;
	var counter = 0;	
			  	
	var pos = searchStr.toLowerCase().indexOf(searchItem.toLowerCase());	  	
	while(pos > -1){
		counter = counter + 1;
		var startString = pos + lenSearchItem;  	  		  			  			  		
		pos = searchStr.toLowerCase().indexOf( searchItem.toLowerCase(), (startString + 1) );	  		
	}

  	return counter;
}

function largeimgsized( itmtitle, key, img ){
	var enableShopping = document.jsvalue.EnableShoppingJ.value;
	if(enableShopping != "yes"){
		alert(shoppingNoLongerAvailable); 
		return;
	}

	ky = key;
	mg = img;

	if( (trim(ky, " ") =="") || (trim(mg, " ") == "") ) {
		alert("There is no larger image to view.");
		return;
	}	

	var dbpath = document.jsvalue.SiteDBJ.value;
	var gString = document.jsvalue.StringBuilderSiteJ.value;
	var url = "/" + dbpath + "/largeitemimage?open" + "&ky=" + ky + "&mg=" + mg + "&itmtitle=" + itmtitle + gString + getSeq();	
	var w = window.open (url, 'shlargeimage', 'resizable=yes, scrollbars=yes, toolbar=no, location=no, status=yes, top=50, left=50, width=514, height=521');

	w.opener = self;
	w.focus();
}	

function SaveHTMLDocAs(){
	if (document.execCommand){
		document.execCommand("SaveAs")
	}else {
		alert("Save As feature is only available in Internet Exlorer 5.x. and above")
	}
}

function left(searchStr, searchItem) {
// Goes through a given string and returns the left string of the searchItem.
//By Felix Odiase(cyberinvader.com) 

	var l_String = "";
	searchItem = String(searchItem);
	
	if( isNumeral( searchItem, "positive_Integers" ) ){
		l_String = searchStr.substring(0, searchItem);  
	}else{
		var lenSearchItem = searchItem.length;
		var pos = searchStr.toLowerCase().indexOf(searchItem.toLowerCase());	  	
	
		if(pos > -1){
			l_String = searchStr.substring(0, (pos+1));  		
		}
	}
	
  	return l_String;
}

function right(searchStr, searchItem) {
// Goes through a given string and returns the left string of the searchItem.
//By Felix Odiase(cyberinvader.com) 
	var r_String = "";
	var lenSearchStr = searchStr.length;
	
	if( isNumeral( String(searchItem), "positive_Integers" ) ){
		var lenSearchItem = searchItem;
		var st_point = lenSearchStr - lenSearchItem;		
		r_String = searchStr.substring(st_point, lenSearchStr);
	}else{
		var lenSearchItem = searchItem.length;
		var pos = searchStr.toLowerCase().indexOf(searchItem.toLowerCase()); 	
		if(pos > -1){	
			var st_point = pos + lenSearchItem;
			r_String = searchStr.substring(st_point, lenSearchStr);		
		}
	}		
		  	
  	return r_String;
}

function customFormValidation(docObj){
  	var pMsge = "";
	var msge = "";
 	var titleMsg = "";

	var element = docObj.ValidationMap.value.split(",");	
	for (var i = 0; i < element.length; i++){
		var elementid = element[i];
		var fObj = document.getElementById(elementid);		
		//alert(fObj.name)
		//alert(fObj.style.visibility)
		
		if( (fObj)  && !(fObj.style.visibility == "hidden") ){ 
			if(fObj.value == ""){
				var elementName = fObj.name; 	
				var eName = replaceSubstring(elementName, "_i", "")
				if(trim(eName, " ") == ""){
					eName =  elementName;
				}
		
				var nameStr = implode(explode(eName, "_"), " ");
 				if( (msge == "") && (left(elementid, 1) == "f") ){ 
  					fObj.select();
 					fObj.focus()
  				}
  				
  				msge = msge + "\r\n <" + nameStr + ">";
 			} else {
				if(left(elementid, 1) == "e"){
 					var result = isValidEmail( fObj.value );
					if( !result ){
  						alert('The email address you entered is not valid. Please enter a valid email address to continue.');
  						fObj.select();
 						fObj.focus()
  						return false;
					}
 				}
 			}
 		} 
	}

//**************************************************************
//Display Error msg if there is any. 
//**************************************************************

 	if(msge != ""){
  		titleMsg =  "The following is/are required to process your request:" + msge;
 		msgDisp( titleMsg );
  		return false;
 	} 
 	
      return true;
}   //validation()

function getShoppingCategory( unid ){
	var dbpath = document.jsvalue.ContentDBJ.value;
	var gString = document.jsvalue.StringBuilderSiteJ.value;
	
	var x = screen.availWidth * 0.35;
	var y = screen.availHeight * 0.10;

	var url = "/" + dbpath + "/0/" + unid + "?editdocument" + gString + getSeq();
	var w = window.open (url, 'shoppingcategory', 'resizable=no, scrollbars=yes, toolbar=no, location=no, status=yes, left=' + x + ', top=' + y + ', width=600, height=460');

	w.opener = self;
	w.focus();
}

function startclock(){

var thetime=new Date();

var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var nsecn=thetime.getSeconds();
var nday=thetime.getDay();
var nmonth=thetime.getMonth();
var ntoday=thetime.getDate();
var nyear=thetime.getYear();
var AorP=" ";

if (nhours>=12)
    AorP="PM";
else
    AorP="AM";

if (nhours>=13)
    nhours-=12;

if (nhours==0)
   nhours=12;

if (nsecn<10)
 nsecn="0"+nsecn;

if (nmins<10)
 nmins="0"+nmins;

if (nday==0)
  nday="Sun";
if (nday==1)
  nday="Mon";
if (nday==2)
  nday="Tue";
if (nday==3)
  nday="Wed";
if (nday==4)
  nday="Thur";
if (nday==5)
  nday="Fri";
if (nday==6)
  nday="Satu";

nmonth+=1;

if (nyear<=99)
  nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
 nyear+=1900;

var time_date = nhours+":"+nmins+":"+nsecn+" "+AorP+" "+nday+", "+nmonth+"/"+ntoday+"/"+nyear;
var fObj = document.getElementById("tdates");
fObj.innerText = time_date;

setTimeout('startclock()',1000);

} 

function loadCustomerProfile( k ) {
	var dbpath = document.jsvalue.ContentDBJ.value;
	var gString = document.jsvalue.StringBuilderSiteJ.value;

	var url = "/" + dbpath + "/LoadCustomerProfile?open&k=" + k + gString	
	window.location.href = url;
}

function groupImage( ){
	var dbpath = document.jsvalue.ILibraryDBJ.value;
	var gstring = document.jsvalue.GeneralStringJ.value;
	var dn = document.jsvalue.DomainNameJ.value;
	url = "/" + dbpath + "/sglphoto?openform&dn=" + dn + getSeq();
	var w = window.open (url, 'winshoppingupload', 'resizable=no, scrollbars=yes, toolbar=no, location=no, status=yes, top=50, left=50, width=595, height=500');
	
	w.opener = self;
	w.focus();
}

//**************************Cookie********************
/*
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/

function Set_Cookie( name, value, expires, path, domain, secure )
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of hours,	
	*/
	if ( expires )
	{
		expires = expires * 1000 * 60 * 60;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}


// this fixes an issue with the old method, ambiguous values
// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

/*
   name - name of the cookie
   [path] - path of the cookie (must be same as path used to create cookie)
   [domain] - domain of the cookie (must be same as domain used to
     create cookie)
   path and domain default if assigned null or omitted if no explicit
     argument proceeds
*/

// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function init_Cookie( dn ){
	var cookie_name  = "cartid";
	var cookie_value = cookie_id;
	var o_cookie = Get_Cookie( cookie_name );
	dn_r = word(o_cookie, "-", 2)

	if( (!o_cookie) || (dn_r != dn) ) {
		Set_Cookie( cookie_name, cookie_value, 4, "/", "","" );
	}else{
		Set_Cookie( cookie_name, o_cookie, 4, "/", "","" );
	}
}

function deleteCookie( ){
	var cookie_name  = "cartid";
	Delete_Cookie( cookie_name, "/","" )
}

function set_CartID_Field( ){
	var cookie_name  = "&cartid";
	o_cookie = Get_Cookie( cookie_name );
	document.forms[0].CartID.value = o_cookie;
}

function cartIDReload( ){
	var url = document.URL  + "&cartflag=yes";
	var cartFlag = document.forms[0].CartFlag.value;
	var cartIDVal = document.forms[0].CartIDVal.value;
	var qString = queryString(url, "dn=");
	
	if( (trim(cartIDVal, " ") ==  "" ) && (trim(cartFlag, " ") == "" ) && (trim(qString, " ") != "") ){
		window.location.replace(url);
	}
}



