// LocalSkillSwap scripts
<!--

function SetAdBody(){
 var headTxt = document.memberAd.TextField.value;
 makeTxt('mem_body',headTxt);
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function makeTxt(id,txt){
var obj = document.getElementById(id);
obj.firstChild?obj.firstChild.data=txt:obj.appendChild(document.createTextNode(txt))
}

function getAd(value){
 var winID = 'advertiser';

 var howWide = 950;
 
 var howHigh = 700;

 var url = 'adtrack.php?adLink='+value;
 
//  var url = 'http://www.localskillswap.com/adtrack.php?adLink='+value;
 var width  = howWide;
 var height = howHigh;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=yes';
 params += ', menubar=yes';
 params += ', resizable=yes';
 params += ', scrollbars=yes';
 params += ', status=yes';
 params += ', toolbar=yes';
 newwin=window.open(url, winID, params);
 if (window.focus) {newwin.focus()}
 return false;
}


function setSelectListToValue(value, selectId){
var i, si, v, args=setSelectListToValue.arguments;
	if ((obj=document.getElementById(args[1])) != null){
	v = args[0];
	for(i=0; i<obj.length; i++){
		if(obj.options[i].value == v){
		si = i;
		}
	}
	obj.selectedIndex = si;
	}
}


// NOTE 15/05/09 javascript to handle the skill listings is partially contained within the PHP functions createJobCategoryList() and selectSubCat()  
// set the value of the list item that is checked
// based on the PHP session vaiable captured in the index.php
function setSwapAreaListValue(selectlistObjx,listObjx) {
var listNamee;
	if(!listObjx) {
		listNamee = "swaplist";
	} else {
		listNamee = listObjx;
	}
// set dropdown list to reflect currently selected Swap area
document.getElementById(listNamee).selectedIndex=selectlistObjx;
}


// return the value of the list item that is visible
function getSwapAreaListValue(listObjx) {
var getValuuu;
var listNamee;
	if(!listObjx) {
		listNamee = "swaplist";
	} else {
		listNamee = listObjx;
	}
		
var getValuuu;
// set dropdown list to reflect currently selected Swap area
getValuuu = document.getElementById(listNamee).selectedIndex.value;
return getValuuu;
}


function showReplyForm() {
	if ((document.getElementById('LKQReplyForm').style.visibility) == 'visible')
		{
		//SET document.getElementById('LKQReplyForm') VALUE;
			document.getElementById('LKQReplyForm').style.visibility = 'hidden';
			document.getElementById('LKQReplyForm').style.display = 'none';
		} else {
		//SET document.getElementById('LKQReplyForm') VALUE;
			document.getElementById('LKQReplyForm').style.visibility = 'visible';
			document.getElementById('LKQReplyForm').style.display = 'block';
		}

	}



function showNewQForm() {
	if ((document.getElementById('LKQNewForm').style.visibility) == 'visible')
		{
		//SET document.getElementById('LKQNewForm') VALUE;
			document.getElementById('LKQNewForm').style.visibility = 'hidden';
			document.getElementById('LKQNewForm').style.display = 'none';
		} else {
		//SET document.getElementById('LKQNewForm') VALUE;
			document.getElementById('LKQNewForm').style.visibility = 'visible';
			document.getElementById('LKQNewForm').style.display = 'block';
		}

	}


function show_tc() 
{
var url='http://www.localskillswap.com/teeandcee.html';

 var width  = 800;
 var height = 700;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=yes';
 params += ', scrollbars=yes';
 params += ', status=no';
 params += ', toolbar=no';
 newwin=window.open(url,'terms_conditions', params);
 if (window.focus) {newwin.focus()}
 return false;
}


function show_help()
{
var url='http://www.localskillswap.com/userhelp.html';

 var width  = 800;
 var height = 700;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=yes';
 params += ', scrollbars=yes';
 params += ', status=no';
 params += ', toolbar=no';
 newwin=window.open(url,'help', params);
 if (window.focus) {newwin.focus()}
 return false;
}


// launch selected website in new window
function launchSite(theOne,windowName,winSize,winHigh)
{
 var winID = '';
 if (!windowName)
	{ winID = 'preview';} else { winID = windowName;}

 var howWide = '';
 if (!winSize)
	{ howWide = 700;} else { howWide = winSize; }
 
 var howHigh = '';
 if (!winHigh)
	{ howHigh = 700;} else { howHigh = winHigh; }

 var url = theOne;
 var width  = howWide;
 var height = howHigh;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=yes';
 params += ', scrollbars=yes';
 params += ', status=yes';
 params += ', toolbar=no';
 newwin=window.open(url, winID, params);
 if (window.focus) {newwin.focus()}
 return false;
}



// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}

/* function to update the job selection lists */
function pushValue(ele) {
	var selected = ele.options[ele.selectedIndex].value;
	var w = document.drop_list.SubCat.selectedIndex;
	var selected_text = document.drop_list.SubCat.options[w].text;
	document.b1_update_skill_form.b1_update_skill_name.value = selected_text;
	document.b1_update_skill_form.b1_hidden_update_new.value = 'Y';
	document.b1_update_skill_form.b1_update_skill_id.value = selected;
}

/* function to update existing job selection lists */
function updateValue(sk_id, txt_up, rating_up) {
	rating_up-- ;
	document.b1_update_skill_form.b1_update_skill_name.value = txt_up;
	document.b1_update_skill_form.b1_hidden_update_new.value = 'U';
	document.b1_update_skill_form.b1_update_skill_id.value = sk_id;
	document.b1_update_skill_form.b1_update_skill_rating.options.selectedIndex = rating_up;
}

/* function to submit delete skill form */
function updateDeleteValue(sk_id) {
	document.delete_skill.delete_skill_id.value = sk_id;
	document.delete_skill.delete_skill_submit.value = sk_id;
	document.delete_skill.submit();
}

/* function to submit delete skillswap item form */
function deleteSwapItemUpdate(swItem) {
	var x=window.confirm("Are you sure you want to remove this record?\nIt will be permanently removed from the list")
	if (x)
	document.deleteSwapItem.deleteSwap_id.value = swItem;
	document.deleteSwapItem.submit();
}



/* function to submit delete skillswap item form */
function deleteClosedSwapSubmit(swItem) {
	var x=window.confirm("Are you sure you want to remove this record?\nIt will be permanently removed from the list")
	if (x)
	document.deleteClosedSwap.deleteClosedSwap_id.value = swItem;
	document.deleteClosedSwap.submit();
}


function sendVote(questID, ansID) {
	document.vote_lkq.v_lkq_Q.value = questID;
	document.vote_lkq.v_lkq_A.value = ansID;
	document.vote_lkq.submit();
}

function reportThis(questID, ansID, memID) {
	document.report_lkq.report_type.value = questID;
	document.report_lkq.report_unique.value = ansID;
	document.report_lkq.report_member.value = memID;
	document.report_lkq.submit();
}

function submitLKQreply() {
	document.lkq_reply_form.submit();
}

function submitNewLKQ() {
	var x=window.confirm("Are you certain you want to submit this question?")
	if (x)
	document.new_lkq_form.submit();
}

function submitContactMember() {
	var x=window.confirm("Are you certain you want to submit this request?")
	if (x)
	document.lss_Contact_Member.submit();
}

function actionSwapRequest() {
	var x=window.confirm("If you wish to confirm this action, click OK")
	if (x)
	document.accept_decline_form.submit();
}

function updateDialogue() {
	var x=window.confirm("Click OK to update this dialogue")
	if (x)
	document.update_dialogue.submit();
}

function publicSubmitQuestion() {
	var x=window.confirm("Click OK to confirm sending this question")
	if (x)
	document.lss_secure_contact.submit();
}

function submitReport() {
	var x=window.confirm("Click OK to continue")
	if (x)
	document.reportThisMember.submit();
}

function submitReportForm() {
	var x=window.confirm("Click OK submit this report")
	if (x)
	document.lss_member_report.submit();
}

function endDialogue() {
	var x=window.confirm("Click OK to end this dialogue")
	if (x)
	document.dialogueClose.submit();
}

function memberRating() {
	var x=window.confirm("Click OK to update the member rating")
	if (x)
	document.memberRatingUpdate.submit();
}

function submitSendLinkForm() {
	var x=window.confirm("Click OK to confirm sending this link")
	if (x)
	document.lss_send_a_link.submit();
}

function SelectSortClick(i) {
	document.alpha_sort.alphabet.value = i;
	document.alpha_sort.submit();
}

function setLKQPage(i) {
	document.page_sort.lkqpage.value = i;
	document.page_sort.submit();
}

function setSWAPPage(i) {
	document.swap_sort.swapPage.value = i;
	document.swap_sort.submit();
}

function submitSearchLKQ() {
	document.search_LKQ.submit();
}

function alertUserReqs(){
alert('Welcome back to LocalSkillSwap! There are 2 steps to complete before you can access the entire website. \n\nFirst, please choose your LocalSkillSwap group. \n\nNext, please select the "Update my skills" tab and add your list of personal skills. \n\nOnce you have done this you will be able to fully utilise the website including viewing the members\' pages and posting LocalSkillSwap requests.');
}
function alertUserReqsMD(){
alert('Welcome back to LocalSkillSwap! There are 2 steps to complete before you can access the entire website. \n\nFirst, please choose your LocalSkillSwap group. \n\nNext, please select the "Update my skills" tab and add your list of personal skills. \n\nOnce you have done this you will be able to fully utilise the website including viewing the members\' pages and posting LocalSkillSwap requests.');
}

function hideswapdetail() {
	if ((document.getElementById('hideswapdetail').style.visibility) == 'visible')
		{
		//SET document.getElementById('showswapdetail') VALUE;
			document.getElementById('hideswapdetail').style.visibility = 'hidden';
			document.getElementById('hideswapdetail').style.display = 'none';
			document.getElementById('showswapdetail').style.visibility = 'visible';
			document.getElementById('showswapdetail').style.display = 'block';
		} else {
		//SET document.getElementById('showswapdetail') VALUE;
			document.getElementById('hideswapdetail').style.visibility = 'visible';
			document.getElementById('hideswapdetail').style.display = 'block';
			document.getElementById('showswapdetail').style.visibility = 'hidden';
			document.getElementById('showswapdetail').style.display = 'none';
		}

	}

function showInfo(thisItem) {
	var t=setTimeout(makeItSo(thisItem),1500);
}

function makeItSo(thisItem){
	document.getElementById(thisItem).style.visibility = 'visible';
	document.getElementById(thisItem).style.display = 'block';
}

function hideThis(thisItem) {
	document.getElementById(thisItem).style.visibility = 'hidden';
	document.getElementById(thisItem).style.display = 'none';
}

function showThisAlert(thisItem) {
alert(thisItem);
}



-->
