String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}//trim
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}//ltrim
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}//rtrim	
function CountRight(field, count, min) 
{
/* if (field.value.length < max)
	 field.value = field.value.substring(0, max);
 else*/
	 count.value = min + field.value.length;
 }
function removeSpaces(string)
{
	 return string.split(' ').join('');
}

function chk_profile(frm)
{
	if(document.getElementById("AppleUser").checked == false && document.getElementById("Company").checked == false && document.getElementById("Independent").checked == false && document.getElementById("NonProfit").checked == false)
	{
		alert("Please select your profile");
		document.getElementById("AppleUser").focus();
		return false;
	}
}

function chk_businessregister(form)
{
	var email = document.getElementById("email").value;
	if(email.trim() == "")
	{
		alert("Please enter email");
		document.getElementById("email").focus();
		return false;
	}//if	
	if(email.trim()!= "" && emailCheck(email) == false)
	{
		alert("Please enter valid email");
		document.getElementById("email").focus();
		return false;
	}//if
	if(document.getElementById("email").value != document.getElementById("email1").value)
	{
		alert("Your email and retype email does not match");
		document.getElementById("email1").focus();
		return false;		
	}
	if(document.getElementById("username").value.trim() == "")
	{
		alert("Please enter username");
		document.getElementById("username").focus();
		return false;
	}//if
	var pass1 = document.getElementById("pass1").value;
	if(pass1.trim() == "")
	{
		alert("Please enter password");
		document.getElementById("pass1").focus();
		return false;
	}//if
	var pass2 = document.getElementById("pass2").value;
	if(pass2.trim() == "")
	{
		alert("Please enter retype password");
		document.getElementById("pass2").focus();
		return false;
	}//if
	if(pass1 != "" && pass2 != "")
	{	
		if(pass1 != pass2)
		{
			alert("password and retype password should be same");
			document.getElementById("pass2").focus();
			return false;
		}//if	
	}//if
/*	if(document.getElementById("first_name").value.trim() == "")
	{
		alert("Please Enter First Name");
		return false;
	}*/
	if(document.getElementById("gender").checked == false && document.getElementById("gender1").checked == false)
	{
		alert("Please select gender");
		document.getElementById("gender").focus();
		return false;
	}//if
	if(document.getElementById("mm").value == "select")
	{
		alert("Please select month");
		document.getElementById("mm").focus();
		return false;
	}//if
	if(document.getElementById("dd").value == "select")
	{
		alert("Please select date");
		document.getElementById("dd").focus();
		return false;
	}//if
	if(document.getElementById("yy").value == "select")
	{
		alert("Please selet year");
		document.getElementById("yy").focus();
		return false;
	}//if
	if(!dobCheck(form))
	{ 
		alert("You must be at least 13 years of age in order to access our site");
		document.getElementById("yy").focus();
		return false;
	}	
	var country = document.getElementById("country").value;
	if(country == "select")
	{
		alert("Please selet country");
		document.getElementById("country").focus();
		return false;
	}//if	
	if(document.getElementById("state").value.trim() == "")
	{
		alert("Please select state");
		document.getElementById("state").focus();
		return false;
	}	
	if(document.getElementById("city").value.trim() == "")
	{
		alert("Please select city");
		document.getElementById("city").focus();
		return false;
	}	
	var zip = document.getElementById("zip").value;
	if(country == "226" || country == "37")
	{
		if(zip.trim() == "")
		{
			alert("Please enter zip");
			document.getElementById("zip").focus();
			return false;
		}
	}
	if(country == '37' && (zip.length != 6 || zip.search(/^[a-zA-Z]{1}\d[a-zA-Z]{1}\d[a-zA-Z]{1}\d$/) == -1))
	{
		alert("Please enter valid zip");
		document.getElementById("zip").focus();
		return false;
	}	
	if(country == '226' &&  (zip.length != 5 || checknumber(zip) == false))
	{
		alert("Please enter valid zip");
		document.getElementById("zip").focus();
		return false;
	}
	if(document.getElementById("profile_image1").value.trim()=="")
	{
		if(document.getElementById("profile_picture").value.trim() == "")
		{
			alert("Please upload profile picture");
			document.getElementById("profile_picture").focus();
			return false;
		}	
	}
	if(document.getElementById("profile_image1").value.trim() != "")
	{
		if(LimitAttach1(document.getElementById("profile_picture").value) == false)
		{
			alert("Please only upload files that end in types: .jpg, .gif, .png");
			document.getElementById("profile_picture").focus();
			return false;
		}//if
	}		
	var about_yourself = document.getElementById("about_yourself").value;
	if(about_yourself.trim() == "" || about_yourself == "Enter a short description about your business!")
	{
		alert("Please enter a short description about your business");
		document.getElementById("about_yourself").focus();
		return false;
	}
	if(document.getElementById("industry").value.trim() == "")
	{
		alert("Please select industry");
		document.getElementById("industry").focus();
		return false;
	}
	if(document.getElementById("job_title").value.trim() == "")
	{
		alert("Please select job title");
		document.getElementById("job_title").focus();
		return false;
	}
	if(document.getElementById("company_size").value.trim() == "")
	{
		alert("Please select company size");
		document.getElementById("company_size").focus();
		return false;
	}
	if(document.getElementById("household_income").value.trim() == "")
	{
		alert("Please select household income");
		document.getElementById("household_income").focus();
		return false;
	}		
	if(document.getElementById("apple_user_since").value.trim() == "")
	{
		alert("Please select apple user since");
		document.getElementById("apple_user_since").focus();
		return false;
	}			
}

function PersonalInterest(form)
{
	/*if(document.getElementById("moment_fame").value.trim() == "")
	{
		alert("Please enter your moment of fame");
		document.getElementById("moment_fame").focus();
		return false;
	}
	if(document.getElementById("apple_knowledge").value.trim() == "")
	{
		alert("Please enter your apple knowledge");
		document.getElementById("apple_knowledge").focus();
		return false;
	}
	if(document.getElementById("fav_films").value.trim() == "")
	{
		alert("Please enter your favorite films");
		document.getElementById("fav_films").focus();
		return false;
	}
	if(document.getElementById("fav_music").value.trim() == "")
	{
		alert("Please enter your favorite music");
		document.getElementById("fav_music").focus();
		return false;
	}
	if(document.getElementById("fav_books").value.trim() == "")
	{
		alert("Please enter your favorite books");
		document.getElementById("fav_books").focus();
		return false;
	}
	if(document.getElementById("fav_travel_dest").value.trim() == "")
	{
		alert("Please enter your favorite travel destination");
		document.getElementById("fav_travel_dest").focus();
		return false;
	}
	if(document.getElementById("fav_sports").value.trim() == "")
	{
		alert("Please enter your favorite sport");
		document.getElementById("fav_sports").focus();
		return false;
	}
	if(document.getElementById("fav_food").value.trim() == "")
	{
		alert("Please enter your favorite food");
		document.getElementById("fav_food").focus();
		return false;
	}
	if(document.getElementById("fav_drink").value.trim() == "")
	{
		alert("Please enter your favorite drink");
		document.getElementById("fav_drink").focus();
		return false;
	}
	if(document.getElementById("fav_actor").value.trim() == "")
	{
		alert("Please enter your favorite actor");
		document.getElementById("fav_actor").focus();
		return false;
	}*/
	if(document.getElementById("terms").checked == false)
	{
		alert("Please read and agree with all terms of service!");
		document.getElementById("terms").focus();
		return false;
	}	
}

function CheckBusinessProfile(frm)
{
	/*if(document.getElementById("businessexpert").value.trim() == "")
	{
		alert("Please enter area of expertise");
		document.getElementById("businessexpert").focus();
		return false;
	}
	if(document.getElementById("businessinfo").value.trim() == "")
	{
		alert("Please enter products/services provided");
		document.getElementById("businessinfo").focus();
		return false;
	}
	if(document.getElementById("companysize").value.trim() == "")
	{
		alert("Please enter company size");
		document.getElementById("companysize").focus();
		return false;
	}
	if(document.getElementById("compwebsite").value.trim() == "")
	{
		alert("Please enter company website");
		document.getElementById("compwebsite").focus();
		return false;
	}
	if(document.getElementById("compsaleemail").value.trim() == "")
	{
		alert("Please enter company sales email");
		document.getElementById("compsaleemail").focus();
		return false;
	}
	var compsaleemail = document.getElementById("compsaleemail").value;
	if(compsaleemail.trim() !=  "" && emailCheck(compsaleemail) == false)
	{
		alert("Please enter valid email");
		document.getElementById("email").focus();
		return false;
	}
	if(document.getElementById("comptelephone").value.trim() == "")
	{
		alert("Please enter company telephone number");
		document.getElementById("comptelephone").focus();
		return false;
	}
	if(document.getElementById("groups").value.trim() == "")
	{
		alert("Please enter groups and association");
		document.getElementById("groups").focus();
		return false;
	}*/
	if(document.getElementById("terms").checked == false)
	{
		alert("Please read and agree with all terms of service!");
		document.getElementById("terms").focus();
		return false;
	}
}


function chk_register(form)
{
	var email = document.getElementById("email").value;
	if(email.trim() == "")
	{
		alert("Please enter email");
		document.getElementById("email").focus();
		return false;
	}//if	
	if(email.trim() !=  "" && emailCheck(email) == false)
	{
		alert("Please enter valid email");
		document.getElementById("email").focus();
		return false;
	}//if
	if(document.getElementById("email").value != document.getElementById("email1").value)
	{
		alert("Your email and retype email does not match");
		document.getElementById("email1").focus();
		return false;		
	}
	if(document.getElementById("username").value.trim() == "")
	{
		alert("Please enter username");
		document.getElementById("username").focus();
		return false;
	}//if
	var pass1 = document.getElementById("pass1").value;
	if(pass1.trim() == "")
	{
		alert("Please enter password");
		document.getElementById("pass1").focus();
		return false;
	}//if
	var pass2 = document.getElementById("pass2").value;
	if(pass2.trim() == "")
	{
		alert("Please enter retype password");
		document.getElementById("pass2").focus();
		return false;
	}//if
	if(pass1 != "" && pass2 != "")
	{	
		if(pass1 != pass2)
		{
			alert("password and retype password should be same");
			document.getElementById("pass2").focus();
			return false;
		}//if	
	}//if
/*	if(document.getElementById("first_name").value.trim() == "")
	{
		alert("Please Enter First Name");
		return false;
	}*/
	if(document.getElementById("gender").checked == false && document.getElementById("gender1").checked == false)
	{
		alert("Please select gender");
		document.getElementById("gender").focus();
		return false;
	}//if
	if(document.getElementById("mm").value == "select")
	{
		alert("Please select month");
		document.getElementById("mm").focus();
		return false;
	}//if
	if(document.getElementById("dd").value == "select")
	{
		alert("Please select date");
		document.getElementById("dd").focus();
		return false;
	}//if
	if(document.getElementById("yy").value == "select")
	{
		alert("Please selet year");
		document.getElementById("yy").focus();
		return false;
	}//if
	if(!dobCheck(form))
	{ 
		alert("You must be at least 13 years of age in order to access our site");
		document.getElementById("yy").focus();
		return false;
	}	
	var country = document.getElementById("country").value;
	if(country == "select")
	{
		alert("Please selet country");
		document.getElementById("country").focus();
		return false;
	}//if	
	if(document.getElementById("state").value.trim() == "")
	{
		alert("Please select state");
		document.getElementById("state").focus();
		return false;
	}	
	if(document.getElementById("city").value.trim() == "")
	{
		alert("Please select city");
		document.getElementById("city").focus();
		return false;
	}	
	var zip = document.getElementById("zip").value;
	if(country == "226" || country == "37")
	{
		if(zip.trim() == "")
		{
			alert("Please enter zip");
			document.getElementById("zip").focus();
			return false;
		}
	}
	if(country == '37' && (zip.length != 6 || zip.search(/^[a-zA-Z]{1}\d[a-zA-Z]{1}\d[a-zA-Z]{1}\d$/) == -1))
	{
		alert("Please enter valid zip");
		document.getElementById("zip").focus();
		return false;
	}	
	if(country == '226' &&  (zip.length != 5 || checknumber(zip) == false))
	{
		alert("Please enter valid zip");
		document.getElementById("zip").focus();
		return false;
	}
	if(document.getElementById("profile_image").value.trim()=="")
	{
		if(document.getElementById("profile_picture").value.trim() == "")
		{
			alert("Please upload profile picture");
			document.getElementById("profile_picture").focus();
			return false;
		}	
	}
	if(document.getElementById("profile_image").value.trim() != "")
	{
		if(LimitAttach1(document.getElementById("profile_picture").value) == false)
		{
			alert("Please only upload files that end in types: .jpg, .gif, .png");
			document.getElementById("profile_picture").focus();
			return false;
		}//if
	}		
	var about_yourself = document.getElementById("about_yourself").value;
	if(about_yourself.trim() == "" || about_yourself == "Enter a short description about yourself!")
	{
		alert("Please enter a short description about yourself");
		document.getElementById("about_yourself").focus();
		return false;
	}
	if(document.getElementById("industry").value.trim() == "")
	{
		alert("Please select industry");
		document.getElementById("industry").focus();
		return false;
	}
	if(document.getElementById("job_title").value.trim() == "")
	{
		alert("Please select job title");
		document.getElementById("job_title").focus();
		return false;
	}
	if(document.getElementById("company_size").value.trim() == "")
	{
		alert("Please select company size");
		document.getElementById("company_size").focus();
		return false;
	}
	if(document.getElementById("household_income").value.trim() == "")
	{
		alert("Please select household income");
		document.getElementById("household_income").focus();
		return false;
	}		
	if(document.getElementById("apple_user_since").value.trim() == "")
	{
		alert("Please select apple user since");
		document.getElementById("apple_user_since").focus();
		return false;
	}			
}//chk_register

function chk_AppleKnowledge(frm)
{
for (var i=0;i < document.frm.elements.length;i++)
	{		
		var e = document.frm.elements[i];
		if (e.type == "radio")
		{					  
		  if(e.checked = false)
		  {
				alert("Please select value of");				
				
		  }
		}
	}
}
/*function chk_AppleKnowledge(frm)
{
	if(document.frm.airport.checked == false)
	{
		alert("Please select Airport value");
		document.frm.airport.focus();
		return false;
	}//if
	if(document.frm.appleTV.checked == false)
	{
		alert("Please select Apple TV value");
		document.frm.appleTV.focus();
		return false;
	}//if
	if(document.getElementById("desktopComputer").checked == false)
	{
		alert("Please select Desktop Computer value");
		document.getElementById("desktopComputer").focus();
		return false;
	}//if
	if(document.getElementById("displays").checked == false)
	{
		alert("Please select displays value");
		document.getElementById("displays").focus();
		return false;
	}//if
	if(document.getElementById("iPhone").checked == false)
	{
		alert("Please select iPhone value");
		document.getElementById("iPhone").focus();
		return false;
	}//if
	if(document.getElementById("iPod").checked == false)
	{
		alert("Please select iPod value");
		document.getElementById("iPod").focus();
		return false;
	}//if
	if(document.getElementById("mightyMouse").checked == false)
	{
		alert("Please select Mighty Mouse value");
		document.getElementById("mightyMouse").focus();
		return false;
	}//if
	if(document.getElementById("notebooks").checked == false)
	{
		alert("Please select notebooks value");
		document.getElementById("notebooks").focus();
		return false;
	}//if
	if(document.getElementById("otherHardware").checked == false)
	{
		alert("Please select other Hardware value");
		document.getElementById("otherHardware").focus();
		return false;
	}//if
	if(document.getElementById("iTunes").checked == false)
	{
		alert("Please select iTunes value");
		document.getElementById("iTunes").focus();
		return false;
	}//if
	if(document.getElementById("keynote").checked == false)
	{
		alert("Please select keynote value");
		document.getElementById("keynote").focus();
		return false;
	}//if
	if(document.getElementById("aperture").checked == false)
	{
		alert("Please select aperture value");
		document.getElementById("aperture").focus();
		return false;
	}//if
	if(document.getElementById("macOS").checked == false)
	{
		alert("Please select macOS value");
		document.getElementById("macOS").focus();
		return false;
	}//if
	if(document.getElementById("iCal").checked == false)
	{
		alert("Please select iCal value");
		document.getElementById("iCal").focus();
		return false;
	}//if
	if(document.getElementById("finalCutPro").checked == false)
	{
		alert("Please select Final Cut Pro value");
		document.getElementById("finalCutPro").focus();
		return false;
	}//if
	if(document.getElementById("iDisk").checked == false)
	{
		alert("Please select iDisk value");
		document.getElementById("iDisk").focus();
		return false;
	}//if
	if(document.getElementById("iWork").checked == false)
	{
		alert("Please select iWork value");
		document.getElementById("iWork").focus();
		return false;
	}//if
	if(document.getElementById("otherSoftware").checked == false)
	{
		alert("Please select other software");
		document.getElementById("otherSoftware").focus();
		return false;
	}//if
}*/

function dobCheck(frm)
{
	var selDay = parseInt(frm.dd.value);
	var selMon =  parseInt(frm.mm.value);
	var selYear =  parseInt(frm.yy.value);
	
	var currentTime = new Date();
	var cur = Array();
	cur[0] = currentTime.getDate();
	cur[1] = (currentTime.getMonth()+1);
	cur[2] = currentTime.getFullYear();

	if( selYear >= cur[2])
	{
		//alert("You must be at least 18 years of age in order to access our site!");
		return false;
	}
	else
	{
			
		if(cur[2]  < (selYear+Number(13)) )
		{
			//alert("You must be at least 18 years of age in order to access our site!");
			return false;
		}
	}	
	return true;
}


function chk_login()
{
	if(document.getElementById("username").value.trim() == "")
	{
		alert("Please Enter Username");
		return false;
	}//if
	if(document.getElementById("password").value.trim() == "")
	{
		alert("Please Enter Password");
		return false;
	}//if
}//chk_login

function chk_uploadLogin()
{
	if(document.getElementById("username").value.trim() == "")
	{
		alert("Please Enter Username");
		return false;
	}//if
	if(document.getElementById("password").value.trim() == "")
	{
		alert("Please Enter Password");
		return false;
	}//if
/*	if(document.getElementById("chk_box").checked == false)
	{
		alert("Please Agree With All Terms and Conditions");
		return false;
	}//if*/
}//chk_uploadLogin()

function emailCheck(emailStr) 
{
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d)\.(\d)\.(\d)\.(\d)\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	
	
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
	        return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]
	
	if (user.match(userPat)==null) {
	    return false
	}
	
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
	          for (var i=1;i<=4;i++) {
	            if (IPArray[i]>255) {
	                return false
	            }
	    }
	    return true
	}
	
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
	    return false
	}
	
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 ||
	    domArr[domArr.length-1].length>3) {
	   return false
	}

	if (len< 2) {
	   return false
	}
	return true;
}//emailCheck

function show_appleKnowledge()
{
	document.getElementById("apple_knowledge").style.display="";
	document.getElementById("hide_apple").style.display="";
	document.getElementById("show_apple").style.display="none";
}//show_appleKnowledge

function hide_appleKnowledge()
{
	document.getElementById("apple_knowledge").style.display="none";
	document.getElementById("hide_apple").style.display="none";
	document.getElementById("show_apple").style.display="";
}//hide_appleKnowledge

function show_physicalAttributes()
{
	document.getElementById("physical_attributes").style.display="";
	document.getElementById("hide_physical").style.display="";
	document.getElementById("show_physical").style.display="none";
}//show_physicalAttributes

function hide_physicalAttributes()
{
	document.getElementById("physical_attributes").style.display="none";
	document.getElementById("hide_physical").style.display="none";
	document.getElementById("show_physical").style.display="";
}//hide_physicalAttributes

function show_favoriteActivities()
{
	document.getElementById("favorite_activities").style.display="";
	document.getElementById("hide_favorite").style.display="";
	document.getElementById("show_favorite").style.display="none";
}//show_physicalAttributes

function hide_favoriteActivities()
{
	document.getElementById("favorite_activities").style.display="none";
	document.getElementById("hide_favorite").style.display="none";
	document.getElementById("show_favorite").style.display="";
}//hide_favoriteActivities

function chk_editProfile()
{
	var email = document.getElementById("email").value;
	var ReEmail = document.getElementById("ReEmail").value;
	if(email.trim() == "")
	{
		alert("Please Enter Email");
		return false;
	}//if	
	if(email.trim() !=  "" && emailCheck(email) == false)
	{
		alert("Please Enter Valid Email");
		return false;
	}//if
	if(ReEmail.trim() == "")
	{
		alert("Please Enter Re-Type Email");
		return false;
	}//if	
	if(ReEmail.trim() !=  "" && emailCheck(ReEmail) == false)
	{
		alert("Please Enter Valid Re-Type Email");
		return false;
	}//if
	if(email.trim() !=  ReEmail.trim())
	{
		alert("Email and Re-Type Email Should Be Same");
		return false;
	}
	if(document.getElementById("username").value.trim() == "")
	{
		alert("Please Enter User Name");
		return false;
	}//if
	var pass1 = document.getElementById("password").value;
	if(pass1.trim() == "")
	{
	alert("Please Enter Password");
		return false;
	}//if
	var pass2 = document.getElementById("retype_password").value;
	if(pass2.trim() == "")
	{
		alert("Please Enter Retype Password");
		return false;
	}//if
	if(pass1 != "" && pass2 != "")
	{	
		if(pass1 != pass2)
		{
			alert("Password and Retype Password Should Be Same");
			return false;
		}//if	
	}//if
	if(document.getElementById("mm").value == "select")
	{
		alert("Please Select Month");
		return false;
	}//if
	if(document.getElementById("dd").value == "select")
	{
		alert("Please Select Date");
		return false;
	}//if
	if(document.getElementById("yy").value == "select")
	{
		alert("Please Selet Year");
		return false;
	}//if
	if(document.getElementById("user_picture").value.trim() != "")
	{
		if(LimitAttach1(document.getElementById("user_picture").value) == false)
		{
			alert("Please Only Upload Files That End In Types: .jpg, .gif, .png");
			return false;
		}//if
	}			
	var country = document.getElementById("AccountCountry").value;
	if(country == "select")
	{
		alert("Please Selet Country");
		return false;
	}//if	
	if(document.getElementById("AccountState").value.trim() == "")
	{
		alert("Please Select State");
		return false;
	}	
	if(document.getElementById("AccountCity").value.trim() == "")
	{
		alert("Please Select City");
		return false;
	}	
	var zip = document.getElementById("zip").value;
	if(country == "226" || country == "37")
	{
		if(zip.trim() == "")
		{
			alert("Please Enter Zip");
			return false;
		}
	}
	if(country == '37' && (zip.length != 6 || zip.search(/^[a-zA-Z]{1}\d[a-zA-Z]{1}\d[a-zA-Z]{1}\d$/) == -1))
	{
		alert("Please Enter Valid Zip");
		return false;
	}	
	if(country == '226' &&  (zip.length != 5 || checknumber(zip) == false))
	{
		alert("Please Enter Valid Zip");
		return false;
	}	
	if(document.getElementById("apple_user_since").value.trim() == "")
	{
		alert("Please Select Apple User Since");
		return false;
	}		
}//chk_editProfile()


function rate_appleProduct(product,var_name)
{
/*	if(product == "otherHardware")
	{
		if(document.getElementById("other_hardware").value.trim() == "")
		{
			alert("Please Enter Other Hardware");	
			return false;
		}//if
	}//if
	if(product == "otherSoftware")
	{
		if(document.getElementById("other_software").value.trim() == "")
		{
			alert("Please Enter Other Software");	
			return false;
		}//if
	}// if*/
	document.myProfile.action = "index.php?option=com_account&task=rating";//&product="+product+"&var_name="+var_name;
	document.myProfile.submit();
}//rate_appleProduct

/**********************   Upload   ***************/
function show_broadcast()
{
	document.getElementById("borad_cast").style.display="";
	document.getElementById("broadcast_close").style.display="";
	document.getElementById("broadcast_show").style.display="none";
    document.getElementById("broadcast_private").style.display="none";
	document.getElementById("broadcast_public").style.display="none";

}//show_broadcast

function hide_broadcast()
{
	document.getElementById("borad_cast").style.display="none";
	document.getElementById("broadcast_close").style.display="none";
	document.getElementById("broadcast_show").style.display="";
	var broadcast = document.getElementById("broadcast2").checked;
	if(broadcast == true)
	{
	  document.getElementById("broadcast_private").style.display="";
	  document.getElementById("broadcast_public").style.display="none";
	}//if
	else
	{
	  document.getElementById("broadcast_private").style.display="none";
	  document.getElementById("broadcast_public").style.display="";
	}//else
}//hide_broadcast

function date_show()
{
	document.getElementById("date_recorded").style.display="";
	document.getElementById("date_hide").style.display="";
	document.getElementById("date_show").style.display="none";
    document.getElementById("date_default").style.display="none";
	document.getElementById("date_set").style.display="none";

}//show_broadcast

function date_hide()
{
	document.getElementById("date_recorded").style.display="none";
	document.getElementById("date_hide").style.display="none";
	document.getElementById("date_show").style.display="";
	if(document.getElementById("dd").value != 0 && document.getElementById("mm").value != 0 && document.getElementById("yy").value != 0) 
	{
		document.getElementById("date_default").style.display="none";
		document.getElementById("date_set").style.display="";			
	}//if
	else
	{
		document.getElementById("date_default").style.display="";
		document.getElementById("date_set").style.display="none";		
	}//else
}//hide_broadcast

function set_calendarDate()
{
	alert("i m here");
	var today = new Date();
	var month = today.getMonth() + 1;
	var day = today.getDate();
	var year = today.getFullYear();
	var form = document.event_step2;
	form.dd[day].selected = true;
	form.mm[month].selected = true;

	for (var i=0; i < form.yy.length; i++) 
	{
		if (form.yy[i].value == year) 
		{
			form.yy[i].selected = true;
		}
	}
	return true;
}

function set_today() 
{
	var today = new Date();
	var month = today.getMonth() + 1;
	var day = today.getDate();
	var year = today.getFullYear();
	var form = document.upload_step2;
	form.dd[day].selected = true;
	form.mm[month].selected = true;

	for (var i=0; i < form.yy.length; i++) 
	{
		if (form.yy[i].value == year) 
		{
			form.yy[i].selected = true;
		}
	}
	return true;
}   

function clear_date() 
{
		var form = document.upload_step2;
		form.dd[0].selected = true;
		form.mm[0].selected = true;
		form.yy[0].selected = true;
}

function sharing_show()
{
	document.getElementById("sharing_option").style.display="";
	document.getElementById("sharing_hide").style.display="";
	document.getElementById("sharing_show").style.display="none";
    document.getElementById("sharing_default").style.display="none";
}//sharing_show

function sharing_hide()
{
	document.getElementById("sharing_option").style.display="none";
	document.getElementById("sharing_hide").style.display="none";
	document.getElementById("sharing_show").style.display="";
    document.getElementById("sharing_default").style.display="";
}//sharing_hide

function chk_uploadStpe2()
{
	if(document.getElementById("title").value.trim() == "")
	{
		alert("Please Enter Title");
		return false;
	}//if
	var description = document.getElementById("description").value;
	if(description.trim() == "")
	{
		alert("Please Enter Description");
		return false;
	}//if
	if(description.trim() != "")
	{
		if(description.length < 25)	
		{
			alert("Please enter description containing at least 25 characters");
			return false;
		}
	}
	if(document.getElementById("tags").value.trim() == "")
	{
		alert("Please Enter Tags");
		return false;
	}//if
	if(document.getElementById("tags").value.trim() == "")
	{
		alert("Please Enter Tags");
		return false;
	}//if
	if(getChkCount('category') == 0 )
	{
      	alert('Please Select Atleast One Category');
		return false;
	}
/*	if(document.getElementById("mm").value == 0)
	{
		alert("Please Select Recorded Month");
		return false;
	}
	if(document.getElementById("dd").value == 0)
	{
		alert("Please Select Recorded Date");
		return false;
	}
	if(document.getElementById("yy").value == 0)
	{
		alert("Please Select Recorded Year");
		return false;
	}*/
}//chk_uploadStpe2()

function getChkCount(txt)
{
	f1 = document.upload_step2;
	var cnt=0;
	for(i=0;i< f1.length;i++)
	{
		var x=f1[i].name;
		
		if( x.indexOf(txt) >=0  &&  f1[i].type=='checkbox'  && f1[i].checked==true)
				cnt++;
	}	
	return cnt;
}


var freeItemCount=0 
var maxFreeItems=3 

function setItems(item)
{ 

  if(item.checked)
  {freeItemCount=freeItemCount+1}

else
 {freeItemCount=freeItemCount-1} 

if (freeItemCount>maxFreeItems)
  {item.checked=false; 
  freeItemCount=freeItemCount-1; 
  alert('You Can Only Select a Maximum of '+maxFreeItems+' Categories'); 
  } 
} 

function open_trouble()
{
	window.open('trouble_uploading.htm','Trouble Uploading','width=500,height=300,resizable=no,scrollbars=yes,status=no,menubar=no,toolbar=no,directories=no,left=200,top=150,screenX=0,screenY=100');		
}//open_trouble

function chk_uploadStpe3()
{
	var file_type = document.getElementById("file_type").value;
	if(file_type == "video")
	{
		if(document.getElementById("video_file").value.trim() == "")
		{
			alert("Please Video Upload File");
			return false;
		}//if
		if(document.getElementById("video_file").value.trim() != "")
		{
			if(LimitAttach(document.getElementById("video_file").value) == false)
			{
				alert("Please Only Upload Files That End In Types: .avi, .dat, .mpeg, .wmv, .mov");
				return false;
			}//if
		}//if
	}//if	
	else if(file_type == "picture")
	{
		if(document.getElementById("picture_file1").value.trim() == "" && document.getElementById("picture_file2").value.trim() == "" && document.getElementById("picture_file3").value.trim() == "" && document.getElementById("picture_file4").value.trim() == "" && document.getElementById("picture_file5").value.trim() == "")
		{
			alert("Please Upload Atleast One Picture");
			return false;
		}//if
		if(document.getElementById("picture_file1").value.trim() != "")
		{
			if(LimitAttach1(document.getElementById("picture_file1").value) == false)
			{
				alert("Please Only Upload Files That End In Types: .jpg, .gif, .png");
				return false;
			}//if
		}//if
		if(document.getElementById("picture_file2").value.trim() != "")
		{
			if(LimitAttach1(document.getElementById("picture_file2").value) == false)
			{
				alert("Please Only Upload Files That End In Types: .jpg, .gif, .png");
				return false;
			}//if
		}//if
		if(document.getElementById("picture_file3").value.trim() != "")
		{
			if(LimitAttach1(document.getElementById("picture_file3").value) == false)
			{
				alert("Please Only Upload Files That End In Types: .jpg, .gif, .png");
				return false;
			}//if
		}//if
		if(document.getElementById("picture_file4").value.trim() != "")
		{
			if(LimitAttach1(document.getElementById("picture_file4").value) == false)
			{
				alert("Please Only Upload Files That End In Types: .jpg, .gif, .png");
				return false;
			}//if
		}//if
		if(document.getElementById("picture_file5").value.trim() != "")
		{
			if(LimitAttach1(document.getElementById("picture_file5").value) == false)
			{
				alert("Please Only Upload Files That End In Types: .jpg, .gif, .png");
				return false;
			}//if
		}//if		
	}//else	if

	if(document.getElementById("HelpingHand").checked == true)
	{
		if(document.getElementById("HelpingWebAddress").value.trim() == "")
		{
			alert("Please enter website address");
			document.getElementById("HelpingWebAddress").focus();
			return false;
		}//
		if(document.getElementById("HelpingWebAddress").value.trim() != "")
		{
			if(isValidURL(document.getElementById("HelpingWebAddress").value) == false)
			{
				alert("Please enter valid website address");
				document.getElementById("HelpingWebAddress").focus();
				return false;
			}//if
		}//
	}//if
	document.getElementById("upload").disabled='true';
	hidden_span = document.getElementById('hide_stuff');
	hidden_span.style.display = 'block';
	return true;		
}//chk_uploadStpe3

extArray = new Array(".avi", ".dat", ".mpeg", ".wmv", ".mov", ".mp4",".AVI", ".DAT", ".MPEG", ".WMV", ".MOV", ".MP4", ".MPG", ".mpg");
	
function LimitAttach(file) 
{
	allowSubmit = false;
	if (!file) return;
	while (file.indexOf("\\") != -1)
	file = file.slice(file.indexOf("\\") + 1);
	ext = file.slice(file.indexOf(".")).toLowerCase();

	for (var i = 0; i < extArray.length; i++) 
	{
		if (extArray[i] == ext) 
		{ 
			allowSubmit = true; 
			break; 
		}//if
	}//for
	if (allowSubmit) 
	{
		return true;
	}//if
	else
	{
		return false;
    }//else	
}//LimitAttach


extArray1 = new Array(".gif", ".jpg", ".jpeg", ".png",".GIF", ".JPG", ".PNG", ".JPEG", ".bmp", ".BMP");
	
function LimitAttach1(file) 
{
	allowSubmit = false;
	if (!file) return;
	while (file.indexOf("\\") != -1)
	file = file.slice(file.indexOf("\\") + 1);
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray1.length; i++) 
	{
		if (extArray1[i] == ext) 
		{ 
			allowSubmit = true; 
			break; 
		}//if
	}//for
	if (allowSubmit) 
	{
		return true;
	}//if
	else
	{
		return false;
    }//else	
}//LimitAttach

function edit_video(video_id,next)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_files/task,editVideo/vid,"+video_id+"/next,"+next+"/";
}//edit_video

function delete_video(video_id,next)
{
	if(confirm("Are you sure you want to delete this file?"))
	{		
		window.location.href = "http://www.macdirectory.com/component/option,com_files/task,deleteVideo/vid,"+video_id+"/next,"+next+"/";
		return true;
	}
	else
		return false;
}//edit_video


function validate_editVideo()
{
	if(document.getElementById("title").value.trim() == "")
	{
		alert("Please enter title");
		return false;
	}//if
	if(document.getElementById("description").value.trim() == "")
	{
		alert("Please enter description");
		return false;
	}//if
	if(document.getElementById("tags").value.trim() == "")
	{
		alert("Please enter tags");
		return false;
	}//if
	if(document.getElementById("tags").value.trim() == "")
	{
		alert("Please enter tags");
		return false;
	}//if
	if(getChkCount1('category') == 0 )
	{
      	alert('Please select atleast one category');
		return false;
	}
	if(document.getElementById("mm").value == 0)
	{
		alert("Please select recorded month");
		return false;
	}
	if(document.getElementById("dd").value == 0)
	{
		alert("Please select recorded date");
		return false;
	}
	if(document.getElementById("yy").value == 0)
	{
		alert("Please select recorded year");
		return false;
	}
		if(document.getElementById("video_file").value.trim() != "")
		{
			if(LimitAttach(document.getElementById("video_file").value) == false)
			{
				alert("Please only upload files that ends in types: .avi, .dat, .mpeg, .wmv, .mov");
				return false;
			}//if
		}//if

		document.getElementById("update_btn").disabled='true';
		hidden_span = document.getElementById('hide_stuff');
		hidden_span.style.display = 'block';
		return true;		
	
}//chk_uploadStpe2()

function getChkCount1(txt)
{
	f1 = document.edit_video;
	var cnt=0;
	for(i=0;i< f1.length;i++)
	{
		var x=f1[i].name;
		
		if( x.indexOf(txt) >=0  &&  f1[i].type=='checkbox'  && f1[i].checked==true)
				cnt++;
	}	
	return cnt;
}


var freeItemCount1=0 
var maxFreeItems1=3 

function setItems1(item)
{ 
//alert(freeItemCount1);
  if(item.checked)
  {freeItemCount1=freeItemCount1+1}
else
 {freeItemCount1=freeItemCount1-1} 

if (freeItemCount1>maxFreeItems1)
  {item.checked=false; 
  freeItemCount1=freeItemCount1-1; 
  alert('You can only select a maximum of '+maxFreeItems1+' categories'); 
  } 
} 

function view_moreInfo()
{
	document.getElementById("moreinfo_link").style.display="none";
	document.getElementById("lessinfo_link").style.display="";
	document.getElementById("less_info").style.display="none";
	document.getElementById("more_info").style.display="";
}//view_moreInfo

function view_lessInfo()
{
	document.getElementById("moreinfo_link").style.display="";
	document.getElementById("lessinfo_link").style.display="none";
	document.getElementById("less_info").style.display="";
	document.getElementById("more_info").style.display="none";
}//view_lessInfo

function edit_photo(album_id,next)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_files/task,editPhoto/aid,"+album_id+"/next,"+next+"/";
}//edit_photo

function delete_photo(album_id,next)
{
	if(confirm("Are you sure you want to delete this file?"))
	{
	window.location.href = "http://www.macdirectory.com/component/option,com_files/task,deletePhoto/aid,"+album_id+"/next,"+next+"/";
		return true;
	}
	else
		return false;
}//edit_photo

function validate_editPhoto()
{
	if(document.getElementById("title").value.trim() == "")
	{
		alert("Please enter title");
		return false;
	}//if
	if(document.getElementById("description").value.trim() == "")
	{
		alert("Please enter description");
		return false;
	}//if
	if(document.getElementById("tags").value.trim() == "")
	{
		alert("Please enter tags");
		return false;
	}//if
	if(document.getElementById("tags").value.trim() == "")
	{
		alert("Please enter tags");
		return false;
	}//if
	if(getChkCount1('category') == 0 )
	{
      	alert('Please select atleast one category');
		return false;
	}
	if(document.getElementById("mm").value == 0)
	{
		alert("Please select recorded month");
		return false;
	}
	if(document.getElementById("dd").value == 0)
	{
		alert("Please select recorded date");
		return false;
	}
	if(document.getElementById("yy").value == 0)
	{
		alert("Please select recorder year");
		return false;
	}
	document.getElementById("update_btn").disabled='true';
	hidden_span = document.getElementById('hide_stuff');
	hidden_span.style.display = 'block';
	return false;		
}//chk_uploadStpe2()

function show_videoToolbar()
{
	document.getElementById("img_video1").style.display="none";
	document.getElementById("img_video2").style.display="";
	document.getElementById("link_video1").style.display="none";
	document.getElementById("link_video2").style.display="";
	document.getElementById("video_toolbar").style.display="";
}//show_videoToolbar

function hide_videoToolbar()
{
	document.getElementById("img_video1").style.display="";
	document.getElementById("img_video2").style.display="none";
	document.getElementById("link_video1").style.display="";
	document.getElementById("link_video2").style.display="none";
	document.getElementById("video_toolbar").style.display="none";
}//show_videoToolbar

function show_videoToolbar1()
{
	document.getElementById("img_video11").style.display="none";
	document.getElementById("img_video21").style.display="";
	document.getElementById("link_video11").style.display="none";
	document.getElementById("link_video21").style.display="";
	document.getElementById("video_toolbar1").style.display="";
}//show_videoToolbar

function hide_videoToolbar1()
{
	document.getElementById("img_video11").style.display="";
	document.getElementById("img_video21").style.display="none";
	document.getElementById("link_video11").style.display="";
	document.getElementById("link_video21").style.display="none";
	document.getElementById("video_toolbar1").style.display="none";
}//show_videoToolbar

function show_photoToolbar()
{
	document.getElementById("img_photo1").style.display="none";
	document.getElementById("img_photo2").style.display="";
	document.getElementById("link_photo1").style.display="none";
	document.getElementById("link_photo2").style.display="";
	document.getElementById("photo_toolbar").style.display="";
}//show_videoToolbar

function hide_photoToolbar()
{
	document.getElementById("img_photo1").style.display="";
	document.getElementById("img_photo2").style.display="none";
	document.getElementById("link_photo1").style.display="";
	document.getElementById("link_photo2").style.display="none";
	document.getElementById("photo_toolbar").style.display="none";
}//show_videoToolbar

function show_memberToolbar()
{
	document.getElementById("img_member1").style.display="none";
	document.getElementById("img_member2").style.display="";
	document.getElementById("link_member1").style.display="none";
	document.getElementById("link_member2").style.display="";
	document.getElementById("member_toolbar").style.display="";
}//show_videoToolbar

function hide_memberToolbar()
{
	document.getElementById("img_member1").style.display="";
	document.getElementById("img_member2").style.display="none";
	document.getElementById("link_member1").style.display="";
	document.getElementById("link_member2").style.display="none";
	document.getElementById("member_toolbar").style.display="none";
}//show_videoToolbar

function view_relatedVideos()
{
	document.getElementById("view_Related").style.display="none";
	document.getElementById("hide_Related").style.display="";
	document.getElementById("related_videos").style.display="";
}//view_relatedVideos

function hide_relatedVideos()
{
	document.getElementById("view_Related").style.display="";
	document.getElementById("hide_Related").style.display="none";
	document.getElementById("related_videos").style.display="none";
}//view_relatedVideos

function chk_video_comments()
{
	if(document.getElementById("videoComments").value.trim() == "")
	{
		alert("Please enter comment");
		return false;
	}
}//chk_video_comments

function view_comments(videoId)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_file1/task,videoAllComments/vid,"+videoId+"/";
}//view_comments

function show_videoCommentReply(com_id)
{
	var video_comment_reply = "video_comment_reply_"+com_id;
	var commment_reply = "commment_reply_"+com_id;
	document.getElementById(video_comment_reply).style.display="";	
	document.getElementById(commment_reply).style.display="none";	
}//show_videoCommentReply()

function chk_vdoCommentReply(com_id)
{
  var reply_txt = "reply_text_"+com_id;
  if(document.getElementById(reply_txt).value.trim() == "")
  {
	  alert("Please enter your comment reply");
	  return false;
  }//if
}//chk_vdoCommentReply

function post_VdoComment(com_id)
{
	document.getElementById("link_postComment").style.display="none";
	document.getElementById("new_vdoComment").style.display=""
}

function chk_postVdoComment()
{
	if(document.getElementById("comment_txt").value.trim() == "")
	{
		alert("Please enter comment");
		return false;
	}
}

function view_relatedvdo_detail()
{
	document.getElementById("related_videoDetail").style.display = "";
	document.getElementById("related_videoBasic").style.display = "none";
}//view_relatedvdo_detail

function view_relatedvdo_basic()
{
	document.getElementById("related_videoDetail").style.display = "none";
	document.getElementById("related_videoBasic").style.display = "";
}//view_relatedvdo_basic

function view_morevdo_detail()
{
	document.getElementById("more_videoDetail").style.display = "";
	document.getElementById("more_videoBasic").style.display = "none";
}//view_morevdo_detail

function view_morevdo_basic()
{
	document.getElementById("more_videoDetail").style.display = "none";
	document.getElementById("more_videoBasic").style.display = "";
}//view_morevdo_basic

function chk_shareVideo()
{
	if(document.getElementById("vdo_emails").value.trim() == "")
	{
		alert("Please enter atleast one email");
		return false;
	}
}//chk_shareVideo

function cancel_shareVideo(video_id)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_files/task,viewVideo/id,"+video_id+"/";	
}//cancel_shareVideo

function chk_sharePhoto()
{
	if(document.getElementById("ph_emails").value.trim() == "")
	{
		alert("Please enter atleast one email");
		return false;
	}
}//chk_shareVideo

function cancel_sharePh0to(album_id)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_files/task,viewPhoto/id,"+album_id+"/";		
}//cancel_shareVideo

function chk_photo_comments()
{
	if(document.getElementById("photoComments").value.trim() == "")
	{
		alert("Please enter commments");
		return false;
	}
}//chk_video_comments

function view_photo_comments(albumId)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_file1/task,photoAllComments/pid,"+albumId+"/";			
}//view_comments

function check_search(docum)
{
/*	if(docum.searchKeyword.value.trim() == "")
	{
		alert("Please Enter Keyword To Search");
		return false;
	}//*/
}//check_search()

function show_videoFlag()
{
	document.getElementById("vdo_flg").style.display = "none";
	document.getElementById("vdo_flg1").style.display = "";
	document.getElementById("video_flag").style.display = "";
}//show_videoFlag()

function close_videoFlag()
{
	document.getElementById("vdo_flg").style.display = "";
	document.getElementById("vdo_flg1").style.display = "none";
	document.getElementById("video_flag").style.display = "none";
}//close_videoFlag

function show_alreadyVideoFlag()
{
	document.getElementById("already_vdo_flag").style.display = "";	
}//show_alreadyVideoFlag

function view_usersAccountInfo()
{
	document.getElementById("Users_Account_Info").style.display = "";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_Subscribers").style.display = "none";
	document.getElementById("Users_History").style.display = "none";
}//view_usersAccountInfo

function view_userProfile()
{
	document.getElementById("Users_Account_Info").style.display = "";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_History").style.display = "none";
	document.getElementById("Users_Subscribers").style.display = "none";}//view_userProfile()

function view_userVideos()
{
	document.getElementById("Users_Account_Info").style.display = "none";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_History").style.display = "none";
	document.getElementById("Users_Subscribers").style.display = "none";}//view_userVideos()

function view_userPhotos()
{
	document.getElementById("Users_Account_Info").style.display = "none";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";
	document.getElementById("Users_Photo").style.display = "";
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_History").style.display = "none";
	document.getElementById("Users_Subscribers").style.display = "none";}//javascript:view_userPhotos()

function view_userFavorites()
{
	document.getElementById("Users_Account_Info").style.display = "none";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_History").style.display = "none";
	document.getElementById("Users_Subscribers").style.display = "none";}//javascript:view_userFavorites()

function view_userFriends()
{
	document.getElementById("Users_Account_Info").style.display = "none";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_History").style.display = "none";
	document.getElementById("Users_Subscribers").style.display = "none";}//javascript:view_userFriends(
							   
function view_userPlaylist()
{
	document.getElementById("Users_Account_Info").style.display = "none";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_History").style.display = "none";
	document.getElementById("Users_Subscribers").style.display = "none";}//view_userPlaylist()

function view_userSubscriptions()
{
	document.getElementById("Users_Account_Info").style.display = "none";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "";	
	document.getElementById("Users_History").style.display = "none";
	document.getElementById("Users_Subscribers").style.display = "none";}//view_userSubscriptions

function view_userSubscribers()
{
	document.getElementById("Users_Account_Info").style.display = "none";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_History").style.display = "none";
	document.getElementById("Users_Subscribers").style.display = "";}//view_userSubscribers()

function viewSubscriptionDetails()
{
	document.getElementById("Users_Account_Info").style.display = "none";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_Subscribers").style.display = "none";		
	document.getElementById("Users_History").style.display = "none";
	document.getElementById("Edit_Subscriptions").style.display = "";		
}//viewSubscriptionDetails

function view_userHistory()
{
	document.getElementById("Users_Account_Info").style.display = "none";	
	//document.getElementById("Users_Profile").style.display = "none";	
	document.getElementById("Users_Video").style.display = "none";	
	document.getElementById("Users_Photo").style.display = "none";	
	document.getElementById("Users_Favorites").style.display = "none";	
	document.getElementById("Users_Friends").style.display = "none";	
	document.getElementById("Users_Playlist").style.display = "none";	
	document.getElementById("Users_Subscriptions").style.display = "none";	
	document.getElementById("Users_Subscribers").style.display = "none";		
	document.getElementById("Users_History").style.display = "";
	document.getElementById("Edit_Subscriptions").style.display = "none";		
}//viewSubscriptionDetails

function user_addFavorites(user_id)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_login/task,addFavorite/to_user,"+user_id+"/";				
}

function user_addFriend(user_id)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_login/task,addFriend/to_user,"+user_id+"/";					
}

function user_sendMessage(user_id)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_login/task,message/to_user,"+user_id+"/";					
}

function check_message()
{
	if(document.getElementById("subject").value.trim() == "")
	{
		alert("Please enter subject");
		return false;
	}
	if(document.getElementById("message").value.trim() == "")
	{
		alert("Please enter message");
		return false;
	}
}//check_message()

function chk_videoArchive()
{
	if(document.getElementById("from_date").value == "")
	{
		alert("Please select from date");
		return false;
	}	
	if(document.getElementById("to_date").value == "")
	{
		alert("Please select to date");
		return false;
	}	
}//chk_videoArchive  

function show_playlist()
{
	document.getElementById("add_playlist").style.display = "";
	document.getElementById("vdo_play").style.display = "none";
	document.getElementById("vdo_play1").style.display = "";
}//show_playlist

function close_playlist()
{
	document.getElementById("add_playlist").style.display = "none";
	document.getElementById("vdo_play").style.display = "";
	document.getElementById("vdo_play1").style.display = "none";
}//show_playlist

function chk_vdoPlaylist()
{
	var videoId = document.getElementById("videoId").value;
	if(document.getElementById("vdo_playlist").value == "select")
	{
		alert("Please select a playlist");
		return false;
	}	
	else if(document.getElementById("vdo_playlist").value == "new_vdo_play_list")
	{
		window.location.href = "http://www.macdirectory.com/component/option,com_playlist/task,new_vdoPlaylist/add_video,"+videoId+"/";					
	}
	return true;
}//chk_vdoPlaylist()

function check_new_vdoPlaylist()
{
	if(document.getElementById("playlist_name").value.trim() == "")
	{
		alert("Please enter playlist name");
		return false;
	}//if
	if(document.getElementById("description").value.trim() == "")
	{
		alert("Please enter description");
		return false;
	}//if
}//check_vdoPlaylist()

function show_vdo_customize()
{
	document.getElementById("vdo_customize").style.display = "none";
	document.getElementById("vdo_customize1").style.display = "";
	document.getElementById("customize_video").style.display = "";
}//show_vdo_customize

function hide_vdo_customize()
{
	document.getElementById("vdo_customize").style.display = "";
	document.getElementById("vdo_customize1").style.display = "none";
	document.getElementById("customize_video").style.display = "none";
}//show_vdo_customize

function remove_favorite(fav_id)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_favorites/task,remove_favorite/fav_id,"+fav_id+"/";					
}

function customize_embed_player(skin)
{
	var site_url = document.getElementById("site_url").value;
	var flv_filename = document.getElementById("flv_filename").value;
    switch (skin)
	{
		case 'red':
			back_color = "0x5d1719";
			front_color = "0xFFFFFF";
			light_color = "0xcd311b";
			break;

		case 'purple':
			back_color = "0x402061";
			front_color = "0xFFFFFF";
			light_color = "0x9461ca";
			break;

		case 'blue':
			back_color = "0x006699";
			front_color = "0xFFFFFF";
			light_color = "0x54abd6";
			break;

		case 'grey':
			back_color = "0xd6d6d6";
			front_color = "0x333333";
			light_color = "0xf0f0f0";
			break;

		case 'orange':
			back_color = "0xe1600f";
			front_color = "0xFFFFFF";
			light_color = "0xfebd01";
			break;

		case 'pink':
			back_color = "0xcc2550";
			front_color = "0xFFFFFF";
			light_color = "0xe87a9f";
			break;

		case 'green':
			back_color = "0x234900";
			front_color = "0xFFFFFF";
			light_color = "0x4e9e00";
			break;

		case 'blue_drk':
			back_color = "0x2b405b";
			front_color = "0xFFFFFF";
			light_color = "0x6b8ab6";
			break;


	}//switch
	var embedCode = '<object type="application/x-shockwave-flash" width="490" height="383" wmode="transparent" data="'+site_url+'/playerflv/flvplayer.swf?file='+site_url+'/'+flv_filename+'&autoStart=true&backcolor='+back_color+'&frontcolor='+front_color+'&lightcolor='+light_color+'"><param name="movie" value="'+site_url+'/playerflv/flvplayer.swf?file='+site_url+'/'+flv_filename+'&autoStart=true&backcolor='+back_color+'&frontcolor='+front_color+'&lightcolor='+light_color+'"/><param name="wmode" value="transparent"/></object>';
	document.getElementById("embed_code").value = embedCode;
}

function chk_photoPlaylist()
{
	var albumId = document.getElementById("albumId").value;
	if(document.getElementById("ph_playlist").value == "select")
	{
		alert("Please select a playlist");
		return false;
	}	
	else if(document.getElementById("ph_playlist").value == "new_ph_play_list")
	{
		window.location.href = "http://www.macdirectory.com/component/option,com_playlist/task,new_ph_Playlist/add_album,"+albumId+"/";					
	}
	return true;		
}//chk_photoPlaylist

function check_invitation()
{
	if(document.getElementById("message").value.trim() == "")
	{
		alert("Please enter message");
		return false;
	}//if
}//check_message

function reject_friend(frn_id)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_friends/task,rejectFriend/friendId,"+frn_id+"/";					
}//reject_friend

function approve_friend(frn_id)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_friends/task,approveFriend/friendId,"+frn_id+"/";					
}//reject_friend

function delete_friend(frn_id)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_friends/task,deleteFriend/friendId,"+frn_id+"/";					
}//reject_friend

function check_playlist()
{
	var email1 = document.getElementById("email_addr1").value;
	var email2 = document.getElementById("email_addr2").value;
	var email3 = document.getElementById("email_addr3").value;
	var email4 = document.getElementById("email_addr4").value;

	if(email1 == "" && email2 == "" && email3 == "" & email4 == "")
	{
		alert("Please enter atleast one email address");
		return false;
	}//if
	if(email1 != "")
	{
		if(emailCheck(email1) == false)
		{
			alert("Please enter valid email address");
			return false;
		}//if
	}//if
	if(email2 != "")
	{
		if(emailCheck(email2) == false)
		{
			alert("Please enter valid email address");
			return false;
		}//if
	}//if
	if(email3 != "")
	{
		if(emailCheck(email3) == false)
		{
			alert("Please enter valid email address");
			return false;
		}//if
	}//if
	if(email4 != "")
	{
		if(emailCheck(email4) == false)
		{
			alert("Please enter valid email address");
			return false;
		}//if
	}//if
}//check_playlist()

function show_sub_allVideo()
{
	document.getElementById("show_video").style.display = "";	
	document.getElementById("show_photos").style.display = "none";	
}//show_sub_allPhoto

function show_sub_allPhoto()
{
	document.getElementById("show_video").style.display = "none";	
	document.getElementById("show_photos").style.display = "";	
}//show_sub_allPhoto

function chk_forgotPassword()
{
	if(document.getElementById("username").value.trim() == "")
	{
		alert("Please enter username");
		return false;
	}//if
	if(document.getElementById("email_id").value.trim() == "")
	{
		alert("Please enter email ID");
		return false;
	}//if
	if(document.getElementById("email_id").value.trim() != "")
	{
		if(emailCheck(document.getElementById("email_id").value) == false)
		{
			alert("Please enter valid email ID");
			return false;
		}//if
	}//if
}//chk_forgotPassword()

//to check unsubscribe email 
function chk_unsubscribe_email()
{
	if(document.getElementById("email").value.trim() == "")
	{
		alert("Please enter email ID");
		return false;
	}//if
	if(document.getElementById("email").value.trim() != "")
	{
		if(emailCheck(document.getElementById("email").value) == false)
		{
			alert("Please enter valid email ID");
			return false;
		}//if
	}//if
}


function OpenWin(URL,width,height,scroll)
{
    var Features ="'toolbar=no,location=no,directories=no,status=no,scrollbars="+ scroll +", menubar=no,marginwidth=0,marginheight=0,resizable=no,width="+ width +",height="+ height +"'";
    var NewWin = window.open(URL,"",Features);
}

function OpenNewsletterWin(URL)
{
    var NewWin = window.open(URL);
}

function vdoDescription(vId)
{
	 window.open ("video_desc.php?id="+vId,"mywindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,width=400,height=300"); 
	
}//vdoDescription
function phDescription(pId)
{
	 window.open ("photo_desc.php?id="+pId,"mywindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,width=400,height=300"); 	
}//vdoDescription
function phChnDescription(pId)
{
	 window.open ("photo_channels.php?id="+pId,"mywindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,width=400,height=300"); 	
}//phChnDescription
function memDescription(mId)
{
	 window.open ("mem_desc.php?id="+mId,"mywindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,width=400,height=300"); 
	
}//vdoDescription

function chk_video_email()
{
	if(document.getElementById("your_name").value.trim() == "")
	{
		alert("Please enter your name");
		return false;
	}//if
	if(document.getElementById("your_email").value.trim() == "")
	{
		alert("Please enter your email");
		return false;
	}//if
	if(document.getElementById("your_email").value.trim() != "")
	{
		if(emailCheck(document.getElementById("your_email").value) == false)
		{
			alert("Please enter valid your email");
			return false;
		}//if
	}//if
	if(document.getElementById("message").value.trim() == "")
	{
		alert("Please Enter Your Message");
		return false;
	}//if
	
}//chk_video_email

function cancel_video_email(vid)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_files/task,viewVideo/id,"+vid+"/";					
}
function cancel_user_email(vid)
{
	window.location.href = "http://www.macdirectory.com/component/option,com_search_mem/task,detailPosted/cond,all/";
}

function showStars(ID)
		{
			if(ID == 1)
				text_disp = "Terrible!";
			if(ID == 2)
				text_disp = "Nothing special";
			if(ID == 3)
				text_disp = "Good";
			if(ID == 4)
				text_disp = "Excellent";
			if(ID == 5)
				text_disp = "Amazing!";

			document.getElementById("defaultRatingMessage").innerHTML=text_disp;
		}//
		function clearStars()
		{
			document.getElementById("defaultRatingMessage").innerHTML=""
		}//
function checkAll(theForm, cName)
  { 
  	if(document.getElementById("checkallbox").checked == true)
	{
  		for (i=0,n=theForm.elements.length;i<n;i++)
		{
			if (theForm.elements[i].name=="check[]") 
	 		{
			 if (theForm.elements[i].checked == true) 
				{
					 theForm.elements[i].checked = true; 
				}
			 else 
				{ 
					theForm.elements[i].checked = true; 
				}
		   } 
		 }
	}//if
	else
	{
  		for (i=0,n=theForm.elements.length;i<n;i++)
		{
			if (theForm.elements[i].name=="check[]") 
	 		{
			 if (theForm.elements[i].checked == true) 
				{
					 theForm.elements[i].checked = false; 
				}
			 else 
				{ 
					theForm.elements[i].checked = false; 
				}
		   } 
		 }	
	}
} 

function check_checkbox(theForm,e_name)
{
	var flag = 1;
	for (i=0,n=theForm.elements.length;i<n;i++)
	{
		if(theForm.elements[i].name==e_name)
		{
			 if (theForm.elements[i].checked == true) 
			 {
			 	flag = 0;
			 }			
		}
	}
	if(flag == 1)
	{
		alert("Please select atleast one check box");
		return false;
	}
	var flags = 1;
	for (i=0,n=theForm.elements.length;i<n;i++)
	{
		if(theForm.elements[i].name==e_name)
		{
			 if (theForm.elements[i].checked == true) 
			 {
			 	flags++;
			 }
		}
	}
    if(confirm( "Permanently delete this message(s)?") )
    {
       return true;
    }//
	else
	    return false;
}

function delMessage()
{
    if(confirm( "Permanently delete this message?") )
    {
       return true;
    }//
	else
	    return false;
}
function addPhotos()
{
	var mainDiv=document.getElementById('div_userPics');
	var num = (document.getElementById('num_pics').value - 1)+ 2;
  	document.getElementById('num_pics').value = num;
	if(num <= 50)
	{
		var newDiv = document.createElement('div');
		var divName = 'div_userPic_'+ num;
		newDiv.setAttribute('id',divName);
		newDiv.setAttribute('style','padding-top:10px;');
		newDiv.innerHTML ="<input type='file'  name='picture_file[]' size='35'>&nbsp;&nbsp;&nbsp;&nbsp;Photo description: <input type='text' id='Credit[]' name='Credit[]' size='45' />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='padding-left:5px;color:#FF0000'><a href='javascript:delete_userPics("+ num +")' class='blue-link11'>Remove</a></span>";
		mainDiv.appendChild(newDiv); 
	}
}

function delete_userPics(divId) 
{
	var mainDiv=document.getElementById('div_userPics');
	var num = document.getElementById('num_pics').value;
  	var childDiv = document.getElementById('div_userPic_'+ divId);
  	mainDiv.removeChild(childDiv);
  	document.getElementById('num_pics').value = num-1;
}

function showProofLink()
{
  document.getElementById("proofTR").style.display = "";	
}//showProofLink()

function showProof()
{
document.getElementById("copyrightTR").style.display = "";	
}//showProof

function hideProofLink()
{
  document.getElementById("proofTR").style.display = "none";	
  document.getElementById("copyrightTR").style.display = "none";	
}//hideProofLink

function delMessage1(mId)
{
    if(confirm( "Permanently delete this message?") )
    {
		window.location.href = "http://www.macdirectory.com/component/option,com_message/task,delete/messageId,"+mId+"/";
        return true;
    }//
}//delMessage1

function viewReplyButton()
{
  document.getElementById("reply").style.display = "none";	
  document.getElementById("reply1").style.display = "";
  document.getElementById("message").focus();
}//viewReplyButton

function ShowHelpingHandUrl()
{
  document.getElementById("HelpingHandTr").style.display = "";
}//viewReplyButton

function HideHelpingHandUrl()
{
  document.getElementById("HelpingHandTr").style.display = "none";
}//viewReplyButton

function CheckVideoFlag()
{
	if(document.getElementById("flag_reason").value == "")
	{
		alert("Please select a reason");
		return false;
	}
}

function createXMLHttpRequest() 
{										 
		var ua;						
		if(window.XMLHttpRequest) 
		{
			try 
			{
				  ua = new XMLHttpRequest();
			} 
			catch(e) 
			{
				  ua = false;								
			}
									
		 }
		  else if(window.ActiveXObject) 
		  {
			 try 
			 {
				ua = new ActiveXObject("Microsoft.XMLHTTP");
			 }
			 catch(e) 
			  {
				 ua = false;
			  }
		  }							
		  return ua;
}//function						

var AccountReq = createXMLHttpRequest();
function GetAccountState()
{
	var AccountCountry = document.getElementById("AccountCountry").value;
	if(AccountCountry != "")
	{	
		AccountReq.open('get', 'AccountStates.php?CountryId='+AccountCountry);
		AccountReq.onreadystatechange = AccountStateHandleResponse;
		AccountReq.send(null);
	}
}//if

function AccountStateHandleResponse()
{
	if(AccountReq.readyState == 4)
	{
		var AccountResponse = AccountReq.responseText;
		document.getElementById('AccountState').innerHTML = AccountResponse;
		GetAccountCity();
	}//if
}//function

var AccountReq1 = createXMLHttpRequest();
function GetAccountCity()
{
	var AccountState = document.getElementById("AccountState").value;
	if(AccountState != "")
	{	
		AccountReq1.open('get', 'AccountCity.php?StateId='+AccountState);
		AccountReq1.onreadystatechange = AccountCityHandleResponse;
		AccountReq1.send(null);
	}
}//if

function AccountCityHandleResponse()
{
	if(AccountReq1.readyState == 4)
	{
		var AccountResponse1 = AccountReq1.responseText;
		document.getElementById('AccountCity').innerHTML = AccountResponse1;
	}//if
}//function

function CheckRegisterCity()
{
	if(document.getElementById("city").value == "Other")	
		document.getElementById("OtherCityTr").style.display = "";	
	else
		document.getElementById("OtherCityTr").style.display = "none";	
}

function CheckAccountCity()
{
	if(document.getElementById("AccountCity").value == "Other")	
		document.getElementById("OtherCityTr").style.display = "";	
	else
		document.getElementById("OtherCityTr").style.display = "none";	
}

function CheckAll(chk)
{
for (var i=0;i < document.frm.elements.length;i++)
	{		
		var e = document.frm.elements[i];
		if (e.type == "checkbox")
		{			
		   e.checked = true;						
		}
		if(document.getElementById("SmartShopper").checked == true)
		{			
				
				document.getElementById("SmartShopper").checked = false;
		}
		if(document.getElementById("emacweekly").checked == true)
		{			
				
				document.getElementById("emacweekly").checked = false;
		}
		if(document.getElementById("emacmonthly").checked == true)
		{			
				
				document.getElementById("emacmonthly").checked = false;
		}
	}
}