function checkDuplicate(objForm, objFeild, actionType)
{
	var objFeildValue = objFeild.value;
	var objFeildID = objFeild.id;


	$("#"+objFeildID).next('span').remove();
	//$("#"+objFeildID).css("color", "green");
	$("#"+objFeildID).css("background", "#ffffff");

	if (actionType == 'EMAILID' && objFeild.value != '')
	{
		emailRegEx = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		if(!emailRegEx.test(objFeild.value))
		{
			$("#"+objFeildID).next('span').remove();
			$("#"+objFeildID).after('&nbsp;<span style="display:none;"><img src="'+DIR_WS_IMAGES+'0active.gif" width="16" height="16" alt="" align="absmiddle" />&nbsp;<b>Invalid Email ID</b></span>');
			//$("#"+objFeildID).css("background", "#FF9F9F");
			$("#"+objFeildID).next('span').css("color", "red");
			$("#"+objFeildID).next('span').fadeIn("slow");
			$("#"+objFeildID).focus();
			$("#"+actionType).val('0');
			return false;
		}
	}

	if (actionType == 'USERNAME' && objFeild.value != '')
	{
		actionType2 = 'VALIDUSERNAME';
		if ( /[^\w-]/.test(objFeild.value))
		{
			$("#"+objFeildID).next('span').remove();
			$("#"+objFeildID).after('&nbsp;<span style="display:none;"><img src="'+DIR_WS_IMAGES+'0active.gif" width="16" height="16" alt="" align="absmiddle" />&nbsp;<b>No special characters allowed, except underscore, hyphen and space.</b></span>');
			//$("#"+objFeildID).css("background", "#FF9F9F");
			$("#"+objFeildID).next('span').css("color", "red");
			$("#"+objFeildID).next('span').fadeIn("slow");
			$("#"+objFeildID).focus();
			$("#"+actionType2).val('0');
			return false
		}
		else
		{
			$("#"+actionType2).val('1');
		}
	}

	if (( actionType == 'USERNAME' || actionType == 'EMAILID' ) && objFeild.value != '')
	{
		strParams = "&"+objFeildID+"="+ objFeild.value+"&actionType="+actionType;
		$.ajax({
				url: HTTP_SERVER+DIR_WS_HTTP+'ajaxValidation.php',
				type: 'POST',
				data: strParams,
				timeout: 3000,
				error: function(strReponseResult){},
				success: function(strReponseResult){
					if (strReponseResult>0)
					{
						$("#"+objFeildID).next('span').remove();
						$("#"+objFeildID).after('&nbsp;<span style="display:none;"><img src="'+DIR_WS_IMAGES+'0active.gif" width="16" height="16" alt="" align="absmiddle" />&nbsp;<b>Not Available</b></span>');
						//$("#"+objFeildID).css("background", "#FF9F9F");
						$("#"+objFeildID).next('span').css("color", "red");
						$("#"+objFeildID).next('span').fadeIn("slow");
						$("#"+objFeildID).focus();
						$("#"+actionType).val('0');
					}
					else
					{
						$("#"+objFeildID).next('span').remove();
						$("#"+objFeildID).after('&nbsp;<span  style="display:none;"><img src="'+DIR_WS_IMAGES+'1active.gif" width="16" height="16" alt="" align="absmiddle" />&nbsp;<b>Available</b></span>');
						//$("#"+objFeildID).css("color", "green");
						//$("#"+objFeildID).css("background", "#ffffff");
						$("#"+objFeildID).next('span').css("background", "#ffffff");
						$("#"+objFeildID).next('span').fadeIn("slow");
						$("#"+actionType).val('1');
					}
				}
		});
	}
}

function checkExtenstion( strFile, ext , type)
{
	//(C)2006 Stephen Chalmers
	var arrExt = ext.split(',');
	var strAvailableExt = '';
	var badName="", allBlank=true, rx;

	for (var i=0; i < arrExt.length; i++)
	{
		rx=new RegExp("[^\.]\."+arrExt[i]+"\s*$", "i");

		if( strFile.length )
		{
			if( rx.test(strFile) )
			{
				return true;
			}
		}
		strAvailableExt += '.'+trim(arrExt[i]) + '<br />';
	}

	var txt = '<table width="100%" cellspacing="0" cellpadding="0" border="0">';
	txt += '<tr>';
	txt += '<td width="64" valign="top"><img src="'+DIR_WS_IMAGES+'icons/Help.png" width="64" height="64" border="0" alt="" align="top"></td>';
	txt += '<td>Following are the accepted extensions for ' + type + '<br /><i>' + strAvailableExt + '<i></td>';
	txt += '</tr></table>';
	alertBox(txt, false);
	//alert( 'Following are the accepted extensions for ' + type + '\n'+strAvailableExt);
	return false;
}

function populateModels(objForm, phoneBrand, selected, objCmbType)
{
	var strExtraParams =  '';
	if (objForm.id == 'frmSignUp' || objForm.id == 'myProfileMySettings' )
	{
		strExtraParams =  '&refrer=registration';
	}
	/*if (phoneBrand.value == '')
	{
		alert("Please select phone brand");
		phoneBrand.focus();
	}
	else*/
	{
		strParams = "&actionType=MODELS&typeID="+phoneBrand.value+"&selected="+selected+"&type="+objCmbType + strExtraParams;
		$.ajax({
				url: HTTP_SERVER+DIR_WS_HTTP+'ajaxPopulateDropdowns.php',
				type: 'POST',
				data: strParams,
				timeout: 3000,
				error: function(strReponseResult){},
				success: function(strReponseResult){
					//var select = $('#cmbPhoneModel');
					var select = $('#cmbPhoneModel'+objCmbType);

					select.html(strReponseResult);
					$('#cmbCategory'+objCmbType).val("");

					if ($('#cmbPhoneBrand'+objCmbType).val()  != "")
					{
						$('#cmbPhoneModel'+objCmbType).attr("disabled","");
					}
					else
					{
						$('#cmbPhoneModel'+objCmbType).attr("disabled","disabled");
						$('#cmbCategory'+objCmbType).attr("disabled","disabled");
					}
				}
		});
	}
}

function populateModelsEmailNotification(objForm, phoneBrand, populateIn,selected, objCmbType)
{
	var strExtraParams =  '';
	if (objForm.id == 'frmSignUp' || objForm.id == 'myProfileMySettings' )
	{
		strExtraParams =  '&refrer=registration';
	}
	/*if (phoneBrand.value == '')
	{
		alert("Please select phone brand");
		phoneBrand.focus();
	}
	else*/
	{
		strParams = "&actionType=MODELS&typeID="+phoneBrand.value+"&selected="+selected+"&type="+objCmbType + strExtraParams;
		$.ajax({
				url: HTTP_SERVER+DIR_WS_HTTP+'ajaxPopulateDropdowns.php',
				type: 'POST',
				data: strParams,
				timeout: 3000,
				error: function(strReponseResult){},
				success: function(strReponseResult){
					//var select = $('#cmbPhoneModel');
					
					var select = $('#'+populateIn+objCmbType);

					select.html(strReponseResult);
					$('#'+populateIn+objCmbType).val("");
					
					var phoneBrandID = phoneBrand.id;
					if ($('#'+phoneBrandID+objCmbType).val() != "")
					{						
						$('#'+populateIn+objCmbType).attr("disabled",false);
					}
					else
					{						
						$('#'+populateIn+objCmbType).attr("disabled","disabled");
						$('#'+populateIn+objCmbType).attr("disabled","disabled");
					}
				}
		});
	}
}

function populateCat(objForm, phoneModel, selected,objCmbType)
{
	/* if (phoneModel.value == '')
	{
		alert("Please select phone model");
		phoneModel.focus();
	}
	else*/
	{
		strParams = "&actionType="+ objCmbType +"&typeID="+phoneModel.value+"&selected="+selected;
		$.ajax({
				url: HTTP_SERVER+DIR_WS_HTTP+'ajaxPopulateDropdowns.php',
				type: 'POST',
				data: strParams,
				timeout: 3000,
				error: function(strReponseResult){},
				success: function(strReponseResult){
					var select = $('#cmbCategory'+objCmbType);
					select.empty("option");
					select.html(strReponseResult);

					if ($('#cmbPhoneModel'+objCmbType).val() != "")
					{
						$('#cmbCategory'+objCmbType).attr("disabled","");
					}
					else
					{
						$('#cmbCategory'+objCmbType).attr("disabled","disabled");
					}
				}
		});
	}
}

function sortBy(objForm, strType , strAuthorID, strWhereClause)
{
	if (strType == 'themes')
	{
		var objSearchType = document.getElementById('frmSearchThemes');
	}
	else if (strType == 'wallpapers')
	{
		var objSearchType = document.getElementById('frmSearchWallpapers');
	}
	else if (strType == 'ringtones')
	{
		var objSearchType = document.getElementById('frmSearchRingtones');
	}
	var searchThemesData = '';
	if (objSearchType)
	{
		searchData = ajaxPost(objSearchType);
	}

	var flagChecked = false;
	var strSortBy = "";
	for (cntChk = 0 ; objForm.elements.length > cntChk ;  cntChk ++)
	{
		if (objForm.elements[cntChk].type == 'radio')
		{
			if (objForm.elements[cntChk].checked == true)
			{
				strSortBy += (strSortBy == "" ? "" : ",") + objForm.elements[cntChk].value;
				flagChecked = true;
			}
		}
	}

	strParams = "&actionType=" + strType + "&sortBy="+strSortBy +"&"+searchData+"&strAuthorID="+ strAuthorID+"&strWhereClause="+strWhereClause;

	$.ajax({
			url: HTTP_SERVER+DIR_WS_HTTP+'ajaxListing.php',
			type: 'POST',
			data: strParams,
			timeout: 3000,
			error: function(strReponseResult){},
			success: function(strReponseResult){
				//alert(objForm.action);
				window.location = objForm.action;
				//$("#listing").empty();
				//$("#listing").html(strReponseResult);
			}
	});

}

/* Function to get all the key value pair of the form elements */
function ajaxPost(objFormName)
{
	/* Initialize the post string with blank value */
	var strPost = '';
	/* For loop to get form elements values in key value pair format */
	for(cntFields=0; cntFields<objFormName.elements.length; cntFields++)
	{
		/* To check is the form element is a radio or check box */
		if( objFormName.elements[cntFields].type == "radio" || objFormName.elements[cntFields].type == "checkbox" )
		{
			/* To get the values of selected radio button or check box */
			if( objFormName.elements[cntFields].checked == true )
			{
				/* To append all  the variable in the name=value format */
				strPost += objFormName.elements[cntFields].name+"="+objFormName.elements[cntFields].value+"&";
			}
		}

		/* To check is the form element is not a radio or check box */
		if( objFormName.elements[cntFields].type != "radio" && objFormName.elements[cntFields].type != "checkbox"  )
		{
			/*
			To append all the variable in the name=value format
			To get values from other form elements used in the question
			*/
			//strPost += objFormName.elements[cntFields].name+"="+ replaceChars( objFormName.elements[cntFields].value ) +"&";
			strPost += objFormName.elements[cntFields].name+"="+ addslashes(escape(objFormName.elements[cntFields].value)) +"&";
		}
	}
	/* To return str of form elements with key value pair format  */
	return strPost;
}

function addslashes (str) {
	// Escapes single quote, double quotes and backslash characters in a string with backslashes 
	//
	// version: 909.322
	// discuss at: http://phpjs.org/functions/addslashes
	// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// +   improved by: Ates Goral (http://magnetiq.com)
	// +   improved by: marrtins
	// +   improved by: Nate
	// +   improved by: Onno Marsman
	// +   input by: Denny Wardhana
	// +   improved by: Brett Zamir (http://brett-zamir.me)
	// *     example 1: addslashes("kevin's birthday");
	// *     returns 1: 'kevin\'s birthday'
	return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\u0000/g, "\\0");
}

function stripslashes (str) {
	// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// +   improved by: Ates Goral (http://magnetiq.com)
	// +      fixed by: Mick@el
	// +   improved by: marrtins
	// +   bugfixed by: Onno Marsman
	// +   improved by: rezna
	// +   input by: Rick Waldron
	// +   reimplemented by: Brett Zamir (http://brett-zamir.me)
	// *     example 1: stripslashes('Kevin\'s code');
	// *     returns 1: "Kevin's code"
	// *     example 2: stripslashes('Kevin\\\'s code');
	// *     returns 2: "Kevin\'s code"
	return (str+'').replace(/\\(.?)/g, function (s, n1) {
		switch (n1) {
			case '\\':
				return '\\';
			case '0':
				return '\0';
			case '':
				return '';
			default:
				return n1;
			}
		});
}

function replaceChars(entry)
{
	re = /^\$|&|{|}|(<\/)|<|>|;|'/g;
	return entry.replace( re, "");
}

function custLoader(action, posTop)
{
	var objLoader = document.getElementById('jqi');
	var txt = "";
	if ( posTop == undefined || posTop == '' )
	{
		posTop = '50';
	}
	if (action == 'show')
	{
		if ( objLoader == null )
		{
			$.prompt(txt,{
				buttons: { },
				top : posTop+'%'
			});
			$("#jqi").css("background","none");
			$("#jqi").css("border","none");
			$('.jqiclose').css("display","none");
			$('#jqistates').css("display","none");
			$('.jqicontainer').css("background","none");
			//$('.jqicontainer').css("border","1px solid red");
			$('.jqicontainer').css("text-align","center");
			$('.jqicontainer').append('<img src="'+DIR_WS_IMAGES+'ajax-loader.gif" id="jqiLoader" border="0" alt="" align="absmiddle" height="50">');
		}
	}
	else if(action == 'hide')
	{
		if ( objLoader != null )
		{
			jQuery.ImpromptuClose();
		}
	}
}

// Alert Box
function alertBox(txt, errFlag)
{
	var msgBoxClass = "msgBox";
	if (errFlag)
	{
		msgBoxClass = "errBox";
	}
	var msg = '<div class="'+msgBoxClass+'">'+txt+'</div>';
	$.prompt(msg,{
		buttons:{Ok:true},
		top:'20%'
	});
}

// Delete Confirm Box
function deleteConfirm(gblDeleteConfirmID)
{
	$('#gblDeleteConfirmID').val(gblDeleteConfirmID);
	var msg = '<div class="msgBox"><img src="'+DIR_WS_IMAGES+'icons/delete.png" width="64" height="64" border="0" alt="" align="absmiddle">Are you sure you want to delete?</div>';
	$.prompt(msg,{
		callback: deleteRecord,
		buttons:{Ok:true, Cancel:false},
		top:'10%'
	});
}

function breakFriendship(userID,status)
{
	var txt = "Are you sure you want to remove friend from friend list";
	$.prompt(txt,{
		buttons:{Ok:-1,Cancel:0},
		submit:function(v,m,f){
			if(v == 0)
			{
				jQuery.ImpromptuClose();
			}
			else if(v == -1)
			{
				jQuery.ImpromptuClose();
				$.ajax({
					type: "POST",
					url: HTTP_SERVER+DIR_WS_HTTP+"myProfileAjax.php",
					data: "actionType=BREAK_FRIENDSHIP&strUserID="+userID+"&status="+status,
					success: function(msg){
						var arrMsg = msg.split('~#~');
						if (arrMsg[0] == 1)
						{
							getProfileMyFriendsDetails(userID);
							$('#divBreakFriendship').hide();
							$('#divFriends').css('display','inline');
							var txt = '<img src="'+DIR_WS_IMAGES+'icons/check.png" width="64" height="64" border="0" alt="" align="absmiddle">Removed from your friends list.';
							alertBox(txt, false);
						}
					}
				});
			}
			return false;
		}
	});
}

function trim(val) {
	var ret = val.replace(/^\s+/, '');
	ret = ret.replace(/\s+$/, '');
	return ret;
}

function getProfileMySettings(strUserID, page)
{
	if (page == undefined)
	{
		page = 0;
	}

	$.ajax({
		type: "POST",
		url: HTTP_SERVER+DIR_WS_HTTP+"myProfileAjax.php",
		data: "actionType=GET_MY_SETTINGS&strUserID="+strUserID+"&page="+page,
		success: function(msg){
			var arrMsg = msg.split('~#~');

			$('#getProfileMySettings').empty();
			$('#getProfileMySettings').html(arrMsg[0]);
			$('#userRankImages').empty();
			$('#userRankImages').html(arrMsg[1]);
		}
	});
}

function uploadUserImage(objForm)
{
	if (objForm.fileProfilePicture.value == "")
	{
		var txt = '<img src="'+DIR_WS_IMAGES+'icons/Help.png" width="64" height="64" border="0" alt="" align="absmiddle">Please select image to upload.';
		alertBox(txt, false);
	}
	else if ( !checkExtenstion(objForm.fileProfilePicture.value, 'jpg,jpeg,gif', 'Avtar' ) )
	{
		return false;
	}
	else
	{
		objForm.submit();
	}
}

function showProfileUpload()
{
	var objDiv = document.getElementById('divProfileUpload');
	objDiv.style.display = '';
}

/* --- Used At Compatible Lilnks --- */
function submitSearchThemes(brandID, modelID, modelName, type)
{
	if (type == 'Ringtones')
	{
		objForm = document.frmSearchRingtones;
		objPhoneBrand = objForm.cmbPhoneBrandRingtones;
		objPhoneModel = objForm.cmbPhoneModelRingtones;
		objPhoneBrand.value = brandID;
		objPhoneModel.disabled=false;
	}
	else if (type == 'Wallpapers')
	{
		objForm = document.frmSearchWallpapers;
		objPhoneBrand = objForm.cmbPhoneBrandWallpapers;
		objPhoneModel = objForm.cmbPhoneModelWallpapers;
		objPhoneBrand.value = brandID;
		objPhoneModel.disabled=false;
	}
	else
	{
		objForm = document.frmSearchThemes;
		objPhoneBrand = objForm.cmbPhoneBrandThemes;
		objPhoneModel = objForm.cmbPhoneModelThemes;
		objPhoneBrand.value = brandID;
		objPhoneModel.disabled=false;
	}

	/*
	var optn = document.createElement("OPTION");
	optn.text = modelName;
	optn.value = modelID;
	objPhoneModel.options.add(optn);
	objPhoneModel.value = modelID;
	*/
	objPhoneModel.length = 0;
	objPhoneModel.options[0]=new Option(modelName, modelID);
	objForm.action = 'browsePhone.php';
	objForm.submit();
}

function profileSubscribe(subscriberID, subscriberName)
{
	$.ajax({
		type: "POST",
		url: HTTP_SERVER+DIR_WS_HTTP+"ajaxMyFriends.php",
		data: "actionType=ADD_TO_WATCH&subscriberID="+subscriberID + "&subscriberName="+subscriberName,
		success: function(msg){

			if (msg == 1)
			{
				var txt = '<img src="'+DIR_WS_IMAGES+'icons/check.png" width="64" height="64" border="0" alt="" align="absmiddle"> '+subscriberName+' successfully added to your watchlist.';
				alertBox(txt, false);
				$('#divSubscribe').empty();
			}
		}
	});
}

function sendNote(objForm, hidID)
{
	objForm.hidID.value = hidID;
	objForm.submit();
}

function checkSpecialChar(objForm, objFeild, actionType)
{
	var objFeildValue = objFeild.value;
	var objFeildID = objFeild.id;
	var checkString = objFeild.value;

	$("#"+objFeildID).next('span').remove();

	if (checkString != "")
	{
		/* ==========
		reference site ==>>	 http://www.evolt.org/article/Regular_Expressions_in_JavaScript/17/36435/
		/[^\w]/ ==> Only A-Z, a-z, 0-9, underscore.
		/[^\w\s]/ ==> Only A-Z, a-z, 0-9, underscore, space.
		/[^\w\s-]/ ==> Only A-Z, a-z, 0-9, space, underscore, hyphen.
		/[^a-zA-Z0-9\s-]/ ==> Only A-Z, a-z, 0-9, hyphen, space.
		 ========== */
		if ( /[^a-zA-Z0-9\s-]/.test(checkString))
		{
			$("#"+objFeildID).next('span').remove();
			$("#"+objFeildID).after('&nbsp;<span style="display:none;"><img src="'+DIR_WS_IMAGES+'0active.gif" width="16" height="16" alt="" align="absmiddle" />&nbsp;<b>No special characters allowed, except hyphen and space</b></span>');
			//$("#"+objFeildID).css("background", "#FF9F9F");
			$("#"+objFeildID).next('span').css("color", "red");
			$("#"+objFeildID).next('span').fadeIn("slow");
			$("#"+objFeildID).focus();
			$("#"+actionType).val('0');
		}
		else
		{
			$("#"+objFeildID).next('span').remove();
			//$("#"+objFeildID).after('&nbsp;<span  style="display:none;"><img src="'+DIR_WS_IMAGES+'1active.gif" width="16" height="16" alt="" align="absmiddle" />&nbsp;<b>Available</b></span>');
			$("#"+objFeildID).after('&nbsp;<span  style="display:none;">&nbsp;</span>');
			$("#"+objFeildID).css("color", "green");
			//$("#"+objFeildID).css("background", "#ffffff")
			//$("#"+objFeildID).next('span').css("background", "#ffffff");
			$("#"+objFeildID).next('span').fadeIn("slow");
			$("#"+actionType).val('1');
		}
	}
}

function checkSpecialCharForTags(strTag)
{
	if ( /[^a-zA-Z0-9\s]/.test(strTag))
	{
		var txt = '<img src="'+HTTP_SERVER+DIR_WS_HTTP+'/images/icons/Help.png" width="64" height="64" border="0" alt="" align="absmiddle">No special characters allowed, except space';
		alertBox(txt, false);
		return false;
	}
	return true;
}

$(document).ready(function(){
  $('.lnkCollectedBy').click(function () {
	  var itemID = $(this).attr('id');
	  var itemType = $(this).attr('name');
	  var itemTitle = $(this).attr('alt');
	  collectedBy(itemID,itemType,itemTitle);
    });
});

function collectedBy(itemID,itemType,itemTitle)
{
	window.open (HTTP_SERVER + DIR_WS_HTTP + itemType + "/" + itemID + "/" + itemTitle,"mywindow","menubar=0,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,width=415px,height=510px");
}

function popupResults(pollID, filename)
{
	var childWindow = window.open (HTTP_SERVER + DIR_WS_HTTP + filename + '/' +pollID, "PollResults","menubar=0,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,width=400px,height=700px"); 
	childWindow.focus();
}

/* Browse phone dropdown changes START */
function populateCat1(objForm, phoneModel, selected,objCmbType)
{
	var categories = document.getElementById('cmbCategory' + objCmbType);

	if (phoneModel.value != "")
	{
		$('#cmbCategory'+objCmbType).attr("disabled","");
	}
	else
	{
		categories.options[0].selected = true;
		$('#cmbCategory'+objCmbType).attr("disabled","disabled");
	}
}

function populateModels11(objForm, phoneBrand, selected, objCmbType, catName)
{
	var phoneModels = document.getElementById('cmbPhoneModel' + objCmbType);
	var categories = document.getElementById('cmbCategory' + objCmbType);
	var arrOptions = phoneModels.options;
	var selectedID = 0;

	if (phoneBrand.value != "")
	{
		phoneModels.disabled = false;
		for (i = 0; i < arrOptions.length ; i++)
		{
			if(phoneModels.options[i].className == phoneBrand.value)
			{
				phoneModels.options[i].style.display = "block";
			}
			else
			{
				phoneModels.options[i].style.display  = "none";
			}
			if (selected != "" && phoneModels.options[i].value == selected)
			{
				selectedID = i;
			}
		}
		phoneModels.focus();
	}
	else
	{
		for (i = 0; i < arrOptions.length ; i++)
		{
			phoneModels.options[i].style.display = "block";
		}
		phoneModels.disabled = true;		
	}

	phoneModels.options[0].style.display  = "block";
	phoneModels.options[selectedID].selected = true;
	categories.disabled = true;

	populateCat1(objForm, phoneModels, catName, objCmbType);
}

function populateModels1(objForm, phoneBrand, selected, objCmbType, catName)
{
	var allPhoneModels = document.getElementById('cmbPhoneModelAll' + objCmbType);
	var phoneModels = document.getElementById('cmbPhoneModel' + objCmbType);
	var categories = document.getElementById('cmbCategory' + objCmbType);
	var arrOptions = allPhoneModels.options;
	var selectedID = 0;

	/* Empty the Model List */
	$("#cmbPhoneModel" + objCmbType).empty();
	/* Adds default "All Models" option */
	phoneModelElement = allPhoneModels.options[0].cloneNode(true);
	phoneModels.appendChild(phoneModelElement);
	phoneModels.disabled = true;

	if (phoneBrand.value != "")
	{
		for (i = 1; i < arrOptions.length ; i++)
		{
			if(allPhoneModels.options[i].className == phoneBrand.value)
			{
				phoneModelElement = allPhoneModels.options[i].cloneNode(true);
				phoneModels.appendChild(phoneModelElement);
			}
		}		
	}

	/* Auto select the Model */
	for (i = 0; i < phoneModels.options.length ; i++)
	{
		if(phoneModels.options[i].value == selected)
		{
			phoneModels.options[i].selected = true;
		}
	}

	if (phoneBrand.value != "")
	{
		phoneModels.disabled = false;
		phoneModels.focus();
	}

	categories.disabled = true;
	populateCat1(objForm, phoneModels, catName, objCmbType);
}
/* Browse phone dropdown changes END */


function unWatchMember(subscriberID, subscriberName)
{
	var txt = "Are you sure you want to remove " + subscriberName + " from watch list";
	$.prompt(txt,{		
		buttons:{Ok:-1,Cancel:0},
		submit:function(v,m,f){
			if(v == 0)
			{
				jQuery.ImpromptuClose();
			}
			else if(v == -1)
			{
				jQuery.ImpromptuClose();
				$.ajax({
					type: "POST",
					url: HTTP_SERVER+DIR_WS_HTTP+"ajaxMyFriends.php",
					data: "actionType=REMOVE_FROM_WATCH&subscriberID="+subscriberID + "&subscriberName="+subscriberName,
					success: function(msg){
						if (msg == 1)
						{
							var txt = '<img src="../../images/icons/check.png" width="64" height="64" border="0" alt="" align="absmiddle">'+subscriberName+' successfully removed from watchlist.';
							alertBox(txt, false);
							$('#unwatch_'+subscriberID).hide();
							$('#watch_'+subscriberID).show();
						}
					}
				});
			}
			return false;
		}
	});	
}

function watchMember(subscriberID, subscriberName)
{
	$.ajax({
		type: "POST",
		url: HTTP_SERVER+DIR_WS_HTTP+"ajaxMyFriends.php",
		data: "actionType=ADD_TO_WATCH&subscriberID="+subscriberID + "&subscriberName="+subscriberName,
		success: function(msg){

			if (msg == 1)
			{
				var txt = '<img src="'+DIR_WS_IMAGES+'icons/check.png" width="64" height="64" border="0" alt="" align="absmiddle"> '+subscriberName+' successfully added to your watchlist.';
				alertBox(txt, false);
				$('#unwatch_'+subscriberID).show();
				$('#watch_'+subscriberID).hide();
			}
		}
	});
}