	
	// member/webmaster/uc_full_header.ascx
function MbOver(pos) {
	var S = window.event.srcElement;
	while (S.tagName != "TD") {
		S = S.parentElement;
	}
	if (pos == 0){	
		S.className="mbMsOvr";		
	} else {
		S.className="mbMsOvrHome";
	}
}

// member/webmaster/uc_full_header.ascx
function MbOut(pos) {
	var S = window.event.srcElement;
	while (S.tagName != "TD") {
		S = S.parentElement;
	}
	if (pos == 0){	
		S.className = "mbNotSel";
	} else {
		S.className = "mbNotSelHome";	
	}
}

// member/profile/uc_adult_update.ascx
function OpenHelp(pageNm, section) {
	var url = "../../help/" + pageNm;
	if (section != "") {		
		url = "../../help/" + pageNm + "#" + section;
	}
	window.open(url, 'help','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=120'); 
}

// member/webmaster/uc_full_header.ascx
function OpenChat(url) {
	window.open(url,'chat','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=530'); 	
}

// member/webmaster/uc_full_header.ascx
function OpenPayment(url) {
	window.open(url,'chat','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=750,height=595'); 
}

// member/webmaster/uc_full_header.ascx
function Nav(url) {
	location.href=url;
}

//index.html
function PopUpWindow(WindowName, URL) {
	var width = 500;
	var height = 500;
	window.open(URL,WindowName,'menubar=no,toolbar=no,status=no,width='+width+',height='+height+',resizable=yes,scrollbars=yes');
}

// used by help controls all in /help/
function PopUpEnquiry() {
	var width = 550;
	var height = 300;
	var win = window.open('../member/webmaster/EnquiryFormPlain.aspx?closewin=true','EnquiryForm','menubar=no,toolbar=no,status=no,width='+width+',height='+height+',resizable=yes,scrollbars=yes');
	win.focus();
}


// used by /member/webmaster/EnquiryFormRedirect.aspx
function GetParameter(queryString, parameterName) {
	var parameterName = parameterName + "=";
	if ( queryString.length > 0 ) {
		// Find the beginning of the string
		begin = queryString.indexOf ( parameterName );
		// If the parameter name is not found, skip it, otherwise return the value
		if ( begin != -1 ) {
			// Add the length (integer) to the beginning
			begin += parameterName.length;
			// Multiple parameters are separated by the "&" sign
			end = queryString.indexOf ( "&" , begin );
			if ( end == -1 ) {
				end = queryString.length
			}
		// Return the string
		return unescape ( queryString.substring ( begin, end ) );
	}
	// Return "null" if no parameter has been found
	return "null";
	}
}


//This function is not used in the file it was originally declared in.
//Could it be called in from a file that uses this control?
//member\media\uc_mediadfolder.ascx
function mediaOpenP( mediaId ) {
  if((!OpenWindow) || (OpenWindow.closed == true)) {
    var OpenWindow=window.open("/member/webmaster/PPopUpMediaViewer.aspx?selectedMediaId=" + mediaId ,"media","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=490");
    OpenWindow.focus();
  }
  else {
    OpenWindow.location.href = url;
    OpenWindow.focus();
  }
}


//media\uc_attachGallery.ascx		originally this function was called mediaOpen, but was 
//									renamed to avoid a name collision with the function below
function mediaOpenGallery(id) {
	if((!OpenWindow) || (OpenWindow.closed == true)) {
		var OpenWindow=window.open("/member/webmaster/PopUpMediaViewer.aspx?mediaId=" + id ,"media","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=490");
		OpenWindow.focus();
	} else {
		OpenWindow.location.href = url;
		OpenWindow.focus();
	}
}

//member\mail\uc_showattachments.ascx
function mediaOpen1(appPath, mediaId, passportId) {
	if((!OpenWindow) || (OpenWindow.closed == true)) {
		var OpenWindow=window.open(appPath+"/member/webmaster/PPopUpMediaViewer.aspx?selectedMediaId=" + mediaId + "&selectedPId=" + passportId,"media","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=490");
		OpenWindow.focus();
	} else {
		OpenWindow.location.href = url;
		OpenWindow.focus();
	}
}

//uc_galleryexternal
function mediaOpen(appPath, mediaId, passportId) {
	if((!OpenWindow) || (OpenWindow.closed == true)) {
		var OpenWindow=window.open(appPath + "/member/webmaster/PPopUpMediaViewer.aspx?selectedMediaId=" + mediaId + "&selectedPId=" + passportId,"media","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=490");
		OpenWindow.focus();
	} else {
		OpenWindow.location.href = url;
		OpenWindow.focus();
	}
}

//uc_galleryexternal
function mediaOpenExternal(appPath, mediaId, passportId) {
	if((!OpenWindow) || (OpenWindow.closed == true)) {
		var OpenWindow=window.open(appPath + "/media/ItemGalleryExternal.aspx?selectedMediaId=" + mediaId + "&selectedPId=" + passportId,"media","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=490");
		OpenWindow.focus();
	} else {
		OpenWindow.location.href = url;
		OpenWindow.focus();
	}
}

// /member/webmaster/OnlineNow.aspx
function GoToHome() {
	document.location='home.aspx';
/*	if (window.opener) {	
		window.opener.location='home.aspx';
		self.close();
	} else {
		document.location='home.aspx';
	}
*/
}

//member\search\uc_results_full.ascx
//member\webmaster\Home.aspx
//only from webmaster
function profileOpen(id) {
	if((!OpenWindow) || (OpenWindow.closed == true)) {		
		var OpenWindow=window.open("ViewProfile.aspx?id=" + id,"profile","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=490");
		OpenWindow.focus();
	} else {
		OpenWindow.location.href = url;
		OpenWindow.focus();
	}
}

// hotornot
function profileOpen1(id) {
	if((!OpenWindow) || (OpenWindow.closed == true)) {		
		var OpenWindow=window.open("../webmaster/ViewProfile.aspx?id=" + id,"profile","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=490");
		OpenWindow.focus();
	} else {
		OpenWindow.location.href = url;
		OpenWindow.focus();
	}
}

//member/profile/us_dating_update.ascx
//Changed due to naming conflicts
function viewProfileOpen(id,memberType) {
    if((!OpenWindow) || (OpenWindow.closed == true)) {
        var OpenWindow=window.open("ViewProfile.aspx?id=" + id + "&memberType=" + memberType,"profile","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=490");
        OpenWindow.focus();
    } else {
        OpenWindow.location.href = url;
        OpenWindow.focus();
    }
}


//member\mail\MemberMailBox.ascx			originally this function was called profileOpen, but was 
//											renamed to avoid a name collision with the function above
function profileOpenMailBox(id,memberType) {
    if((!OpenWindow) || (OpenWindow.closed == true)) {
        var OpenWindow=window.open("../webmaster/ViewProfile.aspx?id=" + id + "&memberType=" + memberType,"profile","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=490");
        OpenWindow.focus();
    } else {
        OpenWindow.location.href = url;
        OpenWindow.focus();
    }
}

function profileOpen2(id,memberType,appPath) {
    if((!OpenWindow) || (OpenWindow.closed == true)) {
        var OpenWindow=window.open(appPath + "/member/webmaster/ViewProfile.aspx?id=" + id + "&memberType=" + memberType,"profile","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=490");
        OpenWindow.focus();
    } else {
        OpenWindow.location.href = url;
        OpenWindow.focus();
    }
}

function profileOpen3(id,appPath) {
    if((!OpenWindow) || (OpenWindow.closed == true)) {
        var OpenWindow=window.open(appPath + "/member/webmaster/ViewProfile.aspx?id=" + id,"profile","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=490");
        OpenWindow.focus();
    } else {
        OpenWindow.location.href = url;
        OpenWindow.focus();
    }
}

//member\identity\uc_update.ascx
function locationOpen(partnerId) {
	var OpenWindow = window.open("SelectLocation.aspx?partnerId=" + partnerId, "ah_location", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=350");
	OpenWindow.focus();
}

// member\profile\uc_adult_update.ascx
function locationOpenA(appPath) {
	var openWindow =
		window.open(appPath + "/signup/SelectLocation.aspx","ah_location","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=350");
	openWindow.focus();
}

//member\publish\Blogs.ascx
function messageOpen(appPath, id, passId, fileName, returnPage) {
    if ((!OpenWindow) || (OpenWindow.closed == true)) {
        var OpenWindow = window.open(appPath + '/member/webmaster/PopupComments.aspx?id=' + id + '&parentId=' + passId + '&fileName=' + fileName + '&returnPage=' + returnPage, "Calendar", "width=600,height=490,toolbars=yes,scrollbars=yes,status=yes,resizable=yes");
        OpenWindow.focus();
    } else {
        OpenWindow.location.href = url;
        OpenWindow.focus();
    }
}


//member\webmaster\uc_full_header.ascx
function Logout(appPath) {
	if (top.location != self.location) {
		top.location.href = appPath + '/login.aspx?logout=true';
	} else {
		window.location.href = appPath + '/login.aspx?logout=true';
	} 
}


//member\webmaster\SiteNews.ascx
function siteOpen(appPath, id){
    if ((!OpenWindow) || (OpenWindow.closed == true)) {
        var OpenWindow = window.open(appPath + "/member/webmaster/PopupSiteNews.aspx?Id=" + id,"SiteNews","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=490");
        OpenWindow.focus();
    } else {
        OpenWindow.location.href = url;
        OpenWindow.focus();
    }
}
 
//member\mail\uc_sendmessage.ascx
function insertEmoticon(strEmoticon, clientID){
	var emotTag = "("+strEmoticon+")";
	insertAtCaret(document.getElementById(clientID+'_message'), emotTag);
	
	document.getElementById(clientID+'_message').focus();
	storeCaret(document.getElementById(clientID+'_message'))
	
}

//member\mail\uc_sendmessage.ascx
//store cursor position of text box
function storeCaret (textArea){
	if(document.selection){
		if (textArea.createTextRange)
			textArea.caretPos = document.selection.createRange().duplicate();
	}
}

//member\mail\uc_sendmessage.ascx
//insert text in text area at cursor position
function insertAtCaret (textArea, text){
	if (textArea.createTextRange && textArea.caretPos){
		var caretPos = textArea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
	} else {
		textArea.value += text;
	}
}    

//member\lookingFor\uc_update.ascx
function criteriaOpen(mtype,mtypetext) {
	var OpenWindow = 
		window.open("../webmaster/SelectCriteria.aspx?memberType=" + mtype + "&memberTypeText=" + mtypetext ,"ah_criteria","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=350");
	OpenWindow.focus();
}

//tools\admin\Enquiries\AllEnquiries.ascx
function replyOpen(enquiryId, webmasterId) {
	if((!OpenWindow) || (OpenWindow.closed == true)) {
		var OpenWindow=window.open("EnquiryReplies.aspx?enquiryId=" + enquiryId + "&webmasterId=" + webmasterId,"profile","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=560,height=490");
		OpenWindow.focus();
	} else {
		OpenWindow.location.href = url;
		OpenWindow.focus();
	}
}

//tools\admin\Enquiries\AllEnquiries.ascx
function replyOpen1(enquiryId, webmasterId) {
	if((!OpenWindow) || (OpenWindow.closed == true)) {
		var OpenWindow=window.open("../Enquiries/EnquiryReplies.aspx?enquiryId=" + enquiryId + "&webmasterId=" + webmasterId,"profile","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=560,height=490");
		OpenWindow.focus();
	} else {
		OpenWindow.location.href = url;
		OpenWindow.focus();
	}
}

// from member/profile/uc_display.ascx and uc_dating_original_display.ascx
function mailOpen(id) {

  if((!OpenWindow) || (OpenWindow.closed == true)) {
	var OpenWindow=window.open("../webmaster/SendMessage.aspx?from=" + id ,"mail","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=600");
    //var OpenWindow=window.open("/member/webmaster/PopUpMailConversation.aspx?showCompose=1&from=" + id ,"mail","toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=490");
    OpenWindow.focus();
  }
  else {
    OpenWindow.location.href = url;
    OpenWindow.focus();
  }
}
//profile/uc_display
function sendOpen(profileId, webmasterId) {

  if((!OpenWindow) || (OpenWindow.closed == true)) {
    var OpenWindow=window.open("../webmaster/SendFriend.aspx?passportId=" + profileId + "&webmasterId=" + webmasterId,"profile","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=560,height=490");
    OpenWindow.focus();
  } else {
    OpenWindow.location.href = url;
    OpenWindow.focus();
  }
}

//member/webmaster/PopupMessage.ascx
function GetDate(CtrlName, mainId) {
        if ((!OpenWindow) || (OpenWindow.closed == true)) {
            var OpenWindow = window.open('../publish/Calendar.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + mainId + ":" + CtrlName, "Calendar", "width=400,height=400,top=400,left=400,toolbars=yes,scrollbars=yes,status=yes,resizable=yes");
            OpenWindow.focus();
        } else {
            OpenWindow.location.href = url;
            OpenWindow.focus();
        }
}

//tools/admin/webmaster/checkWebmasters.aspx
function urlOpen(url){	
	urlOpen = new String(url);
	if (urlOpen.substr(0, 7) !=  "http://"){
		window.open("http://" + url,"Site");		
	} else {
		window.open(url,"Site");		
	}
}


//tools/admin/webmaster/signUpWebmaster.aspx
function termsOpen(url) {
    if((!OpenWindow) || (OpenWindow.closed == true)) {
        var OpenWindow=window.open("../../../" + url,"TermsAndConditions","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=645,height=450");
        OpenWindow.focus();
    } else {
        OpenWindow.location.href = url;
        OpenWindow.focus();
    }
}

//tools/admin/webmaster/signUpWebmaster.aspx
function openPreview(height) {
	colour1 = document.forms[0].elements[6].value;
	colour2 = document.forms[0].elements[7].value;
	logoFile = document.forms[0].elements[8].value;
	if (colour1.indexOf("#") > -1) {
		colour1 = colour1.substring(1);
	}
	if (colour2.indexOf("#") > -1) {
		colour2 = colour2.substring(1);
	}
	window.open("../../../webmasterSignUp/preview.aspx?color1=" + colour1 + "&color2=" + colour2 + "&aWebmaster=0&logoFile=" + logoFile,"Preview","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=" + height);
}

//tools/admin/webmaster/signUpWebmaster.aspx
function openUploadFile() {
	window.open("../../../webmasterSignUp/UploadWebLogo.aspx?FormName=_ctl0&CtrlName=fileNameSpecify","Preview","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=650,height=180");
}

//tools/admin/webmaster/signUpWebmaster.aspx
function openDrawLogo() {
	colour1 = document.forms[0].elements[6].value;
	colour2 = document.forms[0].elements[7].value;
	if (colour1.indexOf("#") > -1) {
		colour1 = colour1.substring(1);
	}
	if (colour2.indexOf("#") > -1) {
		colour2 = colour2.substring(1);
	}

    if (colour2.length > 0) {
		window.open("../../../webmasterSignUp/DrawWebLogo.aspx?FormName=_ctl0&CtrlName=fileNameSpecify&color1=" + colour1 + "&color2=" + colour2,"Preview","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=270");
	} else {
	    alert("Enter a second Colour");
	}
}

// tools/admin/webmaster/WebmasterConfig.aspx
function urlOpener(url){
    window.open(url,"Site");
}

// tools/admin/webmaster/WebmasterConfig.aspx
function openPreviewer(webmasterId, height) {
	colour1 = document.forms[0].color1.value;
	colour2 = document.forms[0].color2.value;
	logoFile = document.forms[0].fileNameSpecify.value;
	if (colour1.indexOf("#") > -1) {
		colour1 = colour1.substring(1);
	}
	if (colour2.indexOf("#") > -1) {
		colour2 = colour2.substring(1);
	}
	window.open("../../../webmasterSignUp/preview.aspx?color1=" + colour1 + "&color2=" + colour2 + "&aWebmaster=1&logoFile=" + logoFile + "&webmasterId=" + webmasterId,"Preview","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=" + height);
}

// tools/admin/webmaster/WebmasterConfig.aspx
function openUploadFilePage(webmasterId) {
	window.open("../../../webmasterSignUp/UploadWebLogo.aspx?FormName=_ctl0&CtrlName=fileNameSpecify","Preview","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=650,height=200");
}

// tools/admin/webmaster/WebmasterConfig.aspx
function openDrawLogoFile(webmasterId) {
	colour1 = document.forms[0].color1.value;
	colour2 = document.forms[0].color2.value;
	if (colour1.indexOf("#") > -1) {
		colour1 = colour1.substring(1);
	}
	if (colour2.indexOf("#") > -1) {
		colour2 = colour2.substring(1);
	}

    if (colour1.length > 0){
		window.open("../../../webmasterSignUp/DrawWebLogo.aspx?FormName=_ctl0&CtrlName=fileNameSpecify&color1=" + colour1 + "&color2=" + colour2,"Preview","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=300");
	} else {
		alert("Enter a second colour");
	}
}

function ShowColor(inputColor, displayColorLabel) {
	if (inputColor.length < 6 | inputColor.length > 7) {
		alert('Colour must be a 7 digit Hexadecimal number, ie. #000000');
	} else if (inputColor.indexOf("#") > -1 & inputColor.length <= 6) {			
		alert('Colour must be a 7 digit Hexadecimal number, ie. #000000');
	} else if (inputColor.indexOf("#") > -1 & inputColor.length == 7){
		document.getElementById(displayColorLabel).style.backgroundColor = inputColor;						
//		displayColorTextBox.style.backgroundColor = inputColor;						
	} else if (inputColor.indexOf("#") == -1 & inputColor.length == 7){
		alert('Colour must be a 7 digit Hexadecimal number, ie. #000000');
	} else if (inputColor.indexOf("#") == -1 & inputColor.length == 6){
		document.getElementById(displayColorLabel).style.backgroundColor = "#" + inputColor;
		//displayColorTextBox.style.backgroundColor = "#" + inputColor;
	} else {
	}
}


function confirmChange(){
var accept = confirm("Your 'Am I hot?' or not picture rating will be lost if you change your primary picture. Do you want to continue?");
if (accept)
	return folder.submit() ;
else
	return false ;
}
//used in signup1 to check for javascript
function hideJSMessage(){
			var message = document.getElementById('noJS');
			if(message){
				noJS.style.display='none';
			}
		}



// member/profile/uc_adult_update.ascx
var winCCbill;
function OpenCancelCCBill() {
	if (winCCbill) {
		winCCbill.focus();
	} else {	
		var url = 'https://support.ccbill.com/?client_accnum=927070&client_subacc=0000';
		winCCbill = window.open( url, "Cancel" );
	}
}	



function setCookie(name, value, expire) {
	document.cookie = name + "=" + escape(value)
	+ ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}


var dialerCookie = 'theadulthubDialer';

function ExpireDialerCookie () {

	var today = new Date();
	var expireMill = today.getTime() - (70*365*12*60*60*1000); 
	var expires = new Date(expireMill);		

	SetCookie( dialerCookie, dialerCookie, expires );
}


function SetDialerCookie () {

	var today = new Date();
	var expMinutes = 15;
	var expireMill = today.getTime() + (expMinutes*60*1000);  //minutes = (60 seconds * 1000 milliseconds)
	var expires = new Date(expireMill);

	SetCookie( dialerCookie, dialerCookie, expires );
	//alert( 'setting dialer cookie' );
}

function SetCookie (name, value) {

	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}
