<!-- // Start of AdSubtract JavaScript block; you can ignore this.
     // It is used when AdSubtract blocks cookies or pop-up windows.
document.iMokie = "cookie blocked by AdSubtract";
document.iMferrer = "referrer blocked by AdSubtract";
function iMwin() {
	this.location = "";
	this.frames = new Array(9);
	this.frames[0] = this;
	this.frames[1] = this;
	this.frames[2] = this;
	this.frames[3] = this;
	this.frames[4] = this;
	this.frames[5] = this;
	this.frames[6] = this;
	this.frames[7] = this;
	this.frames[8] = this;
	this.length = 0;
}
// End of AdSubtract JavaScript block. -->
/* bust out of frames always */
function RemoveFrames()
{
	if (self.location != top.location) top.location = self.location;
}

/**********************************************************************************/
function launchWindow(strURL, strName, intWidth, intHeight, strProperties) 
{
	var mywin;
	var intVersion;
	var dummyDate = new Date(); 
	
	intVersion = navigator.appVersion.substring(0,1);
	if (strURL != "") 
	{
		if (strURL.indexOf("?") != -1) { 
			strURL = strURL + "&rnd="
		} else {
			strURL = strURL + "?rnd="
		}
			
		strURL = strURL + dummyDate.getTime();
			
		strURL = Replace(strURL,"@","%40");
	}
	
	if (strProperties == "") {
		strProperties = "scrollbars=yes,resizable=yes,menubar=no,location=no,directories=no,toolbar=no";
	}
	
	strProperties = "status=yes,height=" + intHeight + ",width=" + intWidth + "," + strProperties;

	// replace all non-alphacharacters with X
	if(strName.replace)
		strName = strName.replace(/\W/g,"X");
	
	// lower case the string
	strName = strName.toLowerCase();
	
	mywin = window.open(strURL, strName, strProperties);
	mywin.name = strName
	if (mywin.opener == null) mywin.opener = self;
}

/**********************************************************************************/
function ViewProfile(lngPage, lngPageType, lngMemberID) 
{
	var strName;
	var strUrl;
	strName = 'viewprofile' + lngMemberID;
	strUrl = "default.asp?p=" + lngPage + "&PageType=" + lngPageType + "&MemberID=" + lngMemberID;
	launchWindow(strUrl, strName, 650, 550, 'status=yes,scrollbars=yes,resizable=yes,menubar=no,location=no,directories=no,toolbar=no');
}

/**********************************************************************************/
function AddFriendsToHotList(strBaseForm, lngAction, lngPageType)
{
	var mywin;
	var i;
	var lngCount;
	var strFriendMemberIDs;
	var lngCachedAction;
	var strCachedTarget;

	strFriendMemberIDs = '';
	lngCount = 0
	for (var i=0; i<document.forms[strBaseForm].FriendMemberID.length; i++) {
		if (document.forms[strBaseForm].FriendMemberID[i].checked == true) {
			if (lngCount == 0) 
				strFriendMemberIDs = strFriendMemberIDs + document.forms[strBaseForm].FriendMemberID[i].value;
			else
				strFriendMemberIDs = strFriendMemberIDs + ',' + document.forms[strBaseForm].FriendMemberID[i].value;
			lngCount++;
		}
	}
	
	if(lngCount == 0) {
		alert("Please choose at least one member");
		return;
	}


	mywin = window.open('/blank.htm', 'friends', 'status=yes,height=525,width=750,scrollbars=yes,resizable=yes,menubar=no,location=no,directories=no,toolbar=no');
	if (mywin.opener == null) mywin.opener = self;
	mywin.focus();

	strCachedTarget = document.forms[strBaseForm].target;
	lngCachedAction = document.forms[strBaseForm].elements["a"].value;
	
	strSavedAction = document.forms[strBaseForm].action;
	document.forms[strBaseForm].action = "default.asp?PageType=" + lngPageType
	document.forms[strBaseForm].target = mywin.name;
	document.forms[strBaseForm].elements["a"].value = lngAction;
	document.forms[strBaseForm].submit();
	
	document.forms[strBaseForm].target = strCachedTarget;
	document.forms[strBaseForm].elements["a"].value = lngCachedAction;
	document.forms[strBaseForm].action = strSavedAction;
}

/**********************************************************************************/
function Split(str, strDelimiter) {
	var ary = new Array();
	var lngCurrentLoc;
	var i = 0;
	var strValue;
	var lngLength;
		
	lngCurrentLoc = str.indexOf(strDelimiter);
	while (lngCurrentLoc >= 0) 
	{
		strValue = str.substring(0, lngCurrentLoc);
		if (strValue.length > 0) 
		{
			ary[i++] = strValue
		}
		str = str.substring(lngCurrentLoc + 1, str.length);
		lngCurrentLoc = str.indexOf(strDelimiter);
	}
	if (str.length > 0) 
	{
		ary[i] = str;
	}
	return ary;
}

/**********************************************************************************/
//This is in use by the Java Applet - DO NOT DELETE THIS EVER!
function AddFriendByMemberID(lngFriendID) 
{
	var strURL;
	var strProperties = "Resizable=yes,scrollbars=yes";
	if (lngFriendID == null)
		lngFriendID = "";
	// change the "p" parameter to 27001 to Insert by MemberID
	strURL = '/default.asp?PageType=4&a=26550&ListMemberID=' + lngFriendID + '&MemberID=' + lngFriendID;
	launchWindow(strURL,'EditFriend',750, 525,strProperties);
}

/**********************************************************************************/
//This is in use by the Java Applet - DO NOT DELETE THIS EVER!
function InitiateEMailByMemberID(lngMemberID)
{
	var strURL;
	var strName; 
	var strProperties;
	
	strURL = "/default.asp?p=10040&PageType=4&MemberID=" + lngMemberID;
	strName = "Email" + lngMemberID;
	strProperties = "Resizable=yes,scrollbars=yes";
	launchWindow(strURL, strName, 750, 525, strProperties);
}

/**********************************************************************************/
//This is in use by the Java Applet - DO NOT DELETE THIS EVER!
function LaunchIMByMemberID(lngRecipientMemberID)
{
	launchWindow("/default.asp?a=19540&PageType=1&RecipientMemberID=" + lngRecipientMemberID + "&IMConversationTypeID=1", "IM" + lngRecipientMemberID, 573, 340, "resizable=yes,scrollbars=yes,status=no");
}
/**********************************************************************************/
//This is in use by the Java Applet - DO NOT DELETE THIS EVER!
function LaunchViewProfileByMemberID(lngMemberID) 
{
	launchWindow('/default.asp?p=7070&PageType=4&MemberID=' + lngMemberID, 'ViewProfile' + lngMemberID,750,525,'status=yes,height=525,width=750,scrollbars=yes,resizable=yes,menubar=no,location=no,directories=no,toolbar=no');
}


/**********************************************************************************/
//This is in use by the Java Applet - DO NOT DELETE THIS EVER!
function OpenIMPrintWindow(strContents, newWindow)
{
	newWindow = window.open("","imPrint","width=550,height=480,scrollbars=yes,resizable=yes,menubar=yes,location=no,status=no,directories=no,toolbar=no");
	newWindow.opener = self;
	newWindow.document.open();
	newWindow.document.write( strContents );
	newWindow.document.close();
}

/**********************************************************************************/
function LaunchChat(strRoom) {
	var strURL, strName, strProperties;
	strRoom = strRoom.replace(/\ /g,"+");
	//strRoom = escape(strRoom);
	strURL = "/default.asp?p=12000&IsPopUp=true&PageType=2&ChatRoom=" + strRoom;
	strName = "Chat" + strRoom;
	strProperties = "Resizable=no,scrollbars=no,status=no,statusbar=false";
	launchWindow(strURL, strName, 580, 410, strProperties);
}

/**********************************************************************************/
function LaunchSpellChecker(strWindowName) {
	var strURL, strProperties;
	
	strURL = "/spellcheck/default.asp?Start=true";
	strProperties = "Resizable=yes,scrollbars=yes";
	launchWindow(strURL, strWindowName, 450, 350, strProperties);
}


/**********************************************************************************/
function Replace(str, substring, newstring) {
	if (str.length <= 0)
		return "";

	temp = "" + str; 

	while (temp.indexOf(substring)>-1) {
	pos = temp.indexOf(substring);
	temp = "" + (temp.substring(0, pos) + newstring + temp.substring((pos + substring.length), temp.length));
	}
	return temp;
}

/**********************************************************************************/
function ConfirmDelete(strMessage, strLocation) 
{
	if (confirm(strMessage)) {
		document.location.href = strLocation;
	}
}

/**********************************************************************************/
function CheckAll(frm)
{
	for (var i=0;i<frm.elements.length;i++)
	{
		var e = frm.elements[i];
		if (e.name != 'allbox')
			e.checked = frm.allbox.checked;
	}
}

/**********************************************************************************/
function UnCheckAllExceptOne(form_object, lngItem) {
	if (lngItem == null) {lngItem = 0};
	if (form_object[lngItem].checked == true) {
		var len = form_object.length;
		for (var i = 0; i < len; i++) {
			if (i != lngItem) {
				form_object[i].checked = false;
			}
		}
	}
}

/**********************************************************************************/
function UnCheckTop(form_object) 
{
	form_object[0].checked = false;
}


/**********************************************************************************/
/* Form Validation: Begin													      */
/**********************************************************************************/

function IsEmpty(obj, obj_type)
{
	if (obj_type == "text" || obj_type == "password" || obj_type == "textarea" || obj_type == "file")	{
		if (obj.value.length == 0) {
			obj.focus();
			return true;
		} else {
			return false;
		}
	} else if (obj_type == "select") {
		for (i=0; i < obj.length; i++) {
			if (obj.options[i].selected) {
				if(obj.options[i].value == "") {
					obj.focus();
					return true;
				} else {
					return false;
				}
			}
			
		}
		return true;	
	} else if (obj_type == "radio" || obj_type == "checkbox") {
		if (!obj[0] && obj) {
			if (obj.checked) {
				return false;
			} else {
				obj.focus();
				return true;	
			}
		} else {
			for (i=0; i < obj.length; i++) {
				if (obj[i].checked) {
					return false;
				}
			}
			obj[0].focus();
			return true;
		}
	} else {
		return false;
	}
}

function InLengthRange(object_value, min_value, max_value)
{
	
	if (object_value == null) {
		return true;
	}

	if (min_value == null) {
		min_value = 0;
	}
	
	if (max_value == null) {
		if (object_value.length >= min_value) {
			return true;
		} else {
			return false;
		}
	}
	
	if (object_value.length >= min_value && object_value.length <= max_value) {
		return true;
	} else {
		return false;
	}

}

function InValueRange(object_value, min_value, max_value)
{
	
	if (object_value == null) {
		return true;
	}
	else {
		if (object_value == '')
			return true;
	}

	if (min_value == null) {
		min_value = 0;
	}
	
	

	if (max_value == null) {
		if (object_value >= min_value) {
			return true;
		} else {
			return false;
		}
	}
	
	if (object_value >= min_value && object_value <= max_value) {
		return true;
	} else {
		return false;
	}

}


function TestNumberRange(object_value, min_value, max_value)
{
	// check minimum
	if (min_value != null) {
		if (object_value < min_value) {
			return false;
		}
	}
		
	// check maximum
	if (max_value != null) {
		if (object_value > max_value) {
			return false;
		}
	}
	//All tests passed, so...
	return true;
}

function IsValidDate(month, day, year) {
	var blnRet;

	if (month ==  "" || day == "" || year == "") {
		return true;
	}

	day = parseInt(day)
	month = parseInt(month)
	year = parseInt(year)
	

	if( (day >= 1 && day <= 31) && 
		(month >=1 && month <= 12) && 
		(year > 0) ) {
		blnRet = true;
		switch(month) {
			case 2:
				
				if(day > 28) {
					// check for leap years
					if( ((year % 4 == 0) && (year % 100 != 0)) ||
						(year % 400 == 0) ) {
						if(day > 29) {
							blnRet =  false;
						}
					} else {
						blnRet = false;
					}
				}
				break;
			case 4:
			case 6:
			case 9:
			case 11:
				if(day > 30) {
					blnRet = false;
				}
				break;
			default:
				break;
		}
	} else {
		blnRet = false;
	}
		
	return blnRet;
}

function IsInteger(object_value)
{
    if (object_value.length == 0){
		return true;
	}

	var decimal_format = ".";
	var check_char;

    //The first character can be + -  blank or a digit.
	check_char = object_value.indexOf(decimal_format)

    //Was it a decimal?
	if (check_char < 1) {
		return IsNumeric(object_value);
	} else {
		return false;
	}
}


function IsNumeric(object_value)
{
	//Returns true if value is a number or is NULL
	//otherwise returns false	
	
	if (object_value.length == 0) {
		return true;
	}
	
	//	Returns true if value is a number defined as
	//	having an optional leading + or -.
	// 	having at most 1 decimal point.
	//	otherwise containing only the characters 0-9.
	var start_format = " .+-0123456789";
	var number_format = " .0123456789";
	var check_char;
	var decimal = false;
	var trailing_blank = false;
	var digits = false;
	
	//The first character can be + - .  blank or a digit.
	check_char = start_format.indexOf(object_value.charAt(0))
	//Was it a decimal?
	if (check_char == 1) {
		decimal = true;
	} else if (check_char < 1) {
		return false;
	}
	        
	//Remaining characters can be only . or a digit, but only one decimal.
	for (var i = 1; i < object_value.length; i++)
	{
		check_char = number_format.indexOf(object_value.charAt(i))
		if (check_char < 0) {
			return false;
		} else if (check_char == 1) {
			if (decimal) {		// Second decimal.
				return false;
			} else {
				decimal = true;
			}
		} else if (check_char == 0)	{
			if (decimal || digits) {
				trailing_blank = true;
			}
			// ignore leading blanks
		} else if (trailing_blank) {
			return false;
		} else {
			digits = true;
		}
	}	
	//All tests passed, so...
	return true
}

function IsNumberChar(ch)
{
	return (ch >= '0' && ch <= '9');
}

function IsAlphaChar(ch)
{
	return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}

function IsAlphaNumeric(object_value)
{
	var i;
	var intLength, ch;
	intLength = object_value.length;
	
	for(i = 0; i < intLength; i++) 
	{
		ch = object_value.charAt(i);
		if(!(IsAlphaChar(ch) || IsNumberChar(ch))) {
			return false;
		}
	}
	return true;
}

function IsAlpha(object_value)
{
	var i;
	var intLength, ch;
	intLength = object_value.length;
	
	for(i = 0; i < intLength; i++) 
	{
		ch = object_value.charAt(i);
		if(!IsAlphaChar(ch)) {
			return false;
		}
	}
	return true;
}


function IsEmail(object_value, min_value)
{
	var i, ch, intAtCount, intDotCount;
	
	var strEmailChars = "_-@.~!#$%&*+\"'"

	if (object_value.length == 0) {
		return true;
	}
	var len = object_value.length;
	
	if (len == 0 && min_value == 0) {
		return true;
	}
	
	if (len < min_value) {
		return false;
	}
	
	
	intAtCount = 0;
	intDotCount = 0;
	for(i = 0; i < len; i++) {
		ch = object_value.charAt(i);
		
		if(!(	IsAlphaChar(ch) || 
				IsNumberChar(ch) ||
				strEmailChars.indexOf(ch) != -1) 
			) {
				return false;
		} else {
			if(ch == '@') {
				intAtCount++;
				if(intAtCount > 1) {
					return false;
				}
			} else if (ch == '.') {
				intDotCount++;
			}
		}
	}
	
	return (intDotCount > 0 && intAtCount > 0);
	
}

function IsURL(object_value)
{
	var i, ch, intDotCount;
	
	var strURLChars = "~!@#$%*_+-:/.?&="
	
	var len = object_value.length;
	
	if (object_value.length == 0) {
		return true;
	}
	
	if (object_value.length < 10) {
		return false;
	}
	
	if	((object_value.indexOf("http://") == -1) &&
			(object_value.indexOf("https://") == -1) &&
			(object_value.indexOf("ftp://") == -1)) {
		return false;
	}
	
	intDotCount = 0;
	for(i = 0; i < len; i++) {
		ch = object_value.charAt(i);
		
		if(!(	IsAlphaChar(ch) || 
				IsNumberChar(ch) ||
				strURLChars.indexOf(ch) != -1) 
			) {
				return false;
		} else if(ch == '.') {
			intDotCount++;
		} 
	}
	
	return (intDotCount > 0);
	
}

function IsValidExtension(object_value, extensions)
{
	// ---------------Examples----------------
	// extensions -->   "jpeg, gif, zip"
	// object_value --> "chaka.zip"
	// ---------------------------------------

	var i, ch, intDotCount;
	var test_extension = "";
	var obj_extension = "";
	var len = object_value.length;

	if ((object_value == "") || (extensions == ""))
		return true;
		 
	// --------------------------------------------------
	// First get the extension of the object value
	// --------------------------------------------------
	for (i = len; i > 0; i--) {
		ch = object_value.charAt(i);
		if (ch == '.') {
			intDotCount = i;
			break;
		}
	}	
	
	for (i = (intDotCount + 1); i < len; i++) {
		obj_extension = obj_extension + object_value.charAt(i);
	}

	if (obj_extension.length == 0)
		return false;

	// --------------------------------------------------
	// Then, we compare that string to every extension we passed in
	// --------------------------------------------------

	extensions = extensions.toLowerCase();
	obj_extension = obj_extension.toLowerCase();

	len = extensions.length;
	test_extension = "";

	for (i = 0; i <= len; i++) {

		ch = extensions.charAt(i);

		if ((ch == ',') || (ch == ' ') || (i == len)) {
			if (test_extension.length == 0)
				continue;			
			if (test_extension == obj_extension)
				return true;
			test_extension = "";
		}
		else {
			test_extension = test_extension + ch;
		}
	}
	return false;
}

function LimitInput(field, countfield, maxlimit) 
{
	if (field.value.length > maxlimit) // if too long...trim it!
	{
		field.value = field.value.substring(0, maxlimit);
	}
	// otherwise, update 'characters left' counter
	else
	{
		if (countfield != null) 
			countfield.value = maxlimit - field.value.length;
	}
}
	
function IsCreditCard(object_value) {
  // Encoding only works on cards with less than 19 digits
  if (object_value.length > 19)
    return (false);

  sum = 0; mul = 1; l = object_value.length;
  for (i = 0; i < l; i++) {
    digit = object_value.substring(l - i - 1, l - i);
    tproduct = parseInt(digit ,10) * mul;
    if (tproduct >= 10)
      sum += (tproduct % 10) + 1;
    else
      sum += tproduct;
    if (mul == 1)
      mul++;
    else
      mul--;
  }

  if ((sum % 10) == 0)
    return (true);
  else
    return (false);

} // END FUNCTION isCreditCard()


function ModalBox(blnInterNational, strText)
{
	if (blnInterNational && window.showModalDialog)
	{
		window.showModalDialog("/lib/ModalBox.asp?strText=" + escape(strText),null,"edge:raised;status:no;unadorned:yes;font-size:14px;dialogWidth:20em;dialogHeight:10em");
	}
	else
	{
		alert(strText);
	}
}

/**********************************************************************************/
/* Form Validation: End															  */
/**********************************************************************************/

/**********************************************************************************/
/*	START - FORM OPTIONS (check or uncheck)										  */
/**********************************************************************************/
function UnCheckAllExceptThis(form_object, lngItem) {
	if (lngItem == null) {lngItem = 0};
	if (form_object[lngItem].checked == true) {
		var len = form_object.length;
		for (var i = 0; i < len; i++) {
			if (i != lngItem) {
				form_object[i].checked = false;
			}
		}
	}
}

/**********************************************************************************/
function UnCheckThis(form_object, lngItem) 
{
	form_object[lngItem].checked = false;
	var len = form_object.length;
	var uncheckedAll = true;
	for (var i = 0; i < len; i++){
		if (form_object[i].checked == true){
			uncheckedAll = false;
		}
	}
	if (uncheckedAll == true){
		form_object[0].checked = true;
	}
}

/**********************************************************************************/
/*	END - FORM OPTIONS (check or uncheck)										  */
/**********************************************************************************/

function AddPageToFavorites(strTitle)
{
	if (document.all) {
		if(strTitle.length == 0)
		{
			strTitle = document.title;
		}
		
		window.external.AddFavorite(document.location.href, strTitle);
	}
}

function SwitchImg(strSourceImgName, strNewImage) 
{ 
	if(document.images[strSourceImgName]) 
	{
		document.images[strSourceImgName].src = strNewImage;
		/*if (aryPhotos)
		{
			for (var j=0;j<aryPhotos.length;j++)
			{
				if (aryPhotos[j].toLowerCase() == strNewImage.toLowerCase())
					i = j;
			}
		}*/
	}
} 

function UpdateText(strTagName, strText)
{
	if(document.all[strTagName])
	{
		if(document.all[strTagName].innerHTML) 
		{
			document.all[strTagName].innerHTML = strText;
		}
	}
}

/**********************************************************************************/
/*	Check Flash 6 Version, return boolean										  */
/**********************************************************************************/
function IsFlashMode()
{

} //end of IsFlashMode