//used for hiding form fields in the product form 

function toggleInputs(qrtype){
	//
	
		// Hide everything
		//
		// hide the WPQRStyle
		count=0;
		while(document.getElementById("WPQRStyle_"+count)){
			document.getElementById("WPQRStyle_"+count).style.display="none";
			count++;
		}

		// hide the WPQRLongitude
		count=0;
		while(document.getElementById("WPQRLongitude_"+count)){
			document.getElementById("WPQRLongitude_"+count).style.display="none";
			count++;
		}
		// hide the WPQRLatitude
		count=0;
		while(document.getElementById("WPQRLatitude_"+count)){
			document.getElementById("WPQRLatitude_"+count).style.display="none";
			count++;
		}
		// hide the WPQRLocation
		count=0;
		while(document.getElementById("WPQRLocation_"+count)){
			document.getElementById("WPQRLocation_"+count).style.display="none";
			count++;
		}
		// hide the WPQRMap
	//me	count=0;
	//me	while(document.getElementById("WPQRMap_"+count)){
	//me		document.getElementById("WPQRMap_"+count).style.display="none";
	//me		count++;
	//me	}
		document.getElementById("map_canvas").style.display="none";





		// hide the WPQRName
		count=0;
		while(document.getElementById("WPQRName_"+count)){
			document.getElementById("WPQRName_"+count).style.display="none";
			count++;
		}
		// hide the WPQRJobTitle
		count=0;
		while(document.getElementById("WPQRJobTitle_"+count)){
			document.getElementById("WPQRJobTitle_"+count).style.display="none";
			count++;
		}
		// hide the WPQRBusiness
		count=0;
		while(document.getElementById("WPQRBusiness_"+count)){
			document.getElementById("WPQRBusiness_"+count).style.display="none";
			count++;
		}
		// hide the WPQRWebsite
		count=0;
		while(document.getElementById("WPQRWebsite_"+count)){
			document.getElementById("WPQRWebsite_"+count).style.display="none";
			count++;
		}
		// hide the WPQREmail
		count=0;
		while(document.getElementById("WPQREmail_"+count)){
			document.getElementById("WPQREmail_"+count).style.display="none";
			count++;
		}
		// hide the WPQRAddress
		count=0;
		while(document.getElementById("WPQRAddress_"+count)){
			document.getElementById("WPQRAddress_"+count).style.display="none";
			count++;
		}
		// hide the WPQRTelephone
		count=0;
		while(document.getElementById("WPQRTelephone_"+count)){
			document.getElementById("WPQRTelephone_"+count).style.display="none";
			count++;
		}
		// hide the WPQRInfo
		count=0;
		while(document.getElementById("WPQRInfo_"+count)){
			document.getElementById("WPQRInfo_"+count).style.display="none";
			count++;
		}
		// hide the WPQRImageSize
		count=0;
		while(document.getElementById("WPQRImageSize_"+count)){
			document.getElementById("WPQRImageSize_"+count).style.display="none";
			count++;
		}
		//
		//
	// Now unhide what we need
		// Contact Details Types need most of the fields
		if ((qrtype == "contactdetails_txt") || (qrtype == "contactdetails_me") || (qrtype == "contactdetails_vcard")){
			// UnHide the fields that we  need for an MECARD
			// Unhide the WPQRStyle
			count=0;
			while(document.getElementById("WPQRStyle_"+count)){
				document.getElementById("WPQRStyle_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRName
			count=0;
			while(document.getElementById("WPQRName_"+count)){
				document.getElementById("WPQRName_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRJobTitle
			count=0;
			while(document.getElementById("WPQRJobTitle_"+count)){
				document.getElementById("WPQRJobTitle_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRBusiness
			count=0;
			while(document.getElementById("WPQRBusiness_"+count)){
				document.getElementById("WPQRBusiness_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRWebsite
			count=0;
			while(document.getElementById("WPQRWebsite_"+count)){
				document.getElementById("WPQRWebsite_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQREmail
			count=0;
			while(document.getElementById("WPQREmail_"+count)){
				document.getElementById("WPQREmail_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRAddress
			count=0;
			while(document.getElementById("WPQRAddress_"+count)){
				document.getElementById("WPQRAddress_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRTelephone
			count=0;
			while(document.getElementById("WPQRTelephone_"+count)){
				document.getElementById("WPQRTelephone_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRInfo
			count=0;
			while(document.getElementById("WPQRInfo_"+count)){
				document.getElementById("WPQRInfo_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRImageSize
			count=0;
			while(document.getElementById("WPQRImageSize_"+count)){
				document.getElementById("WPQRImageSize_"+count).style.display="block";
				count++;
			}
		}
		// Now unhide what we need
		if (qrtype == "emailaddress")
		{
			// display the fields that we need for email address
			// Unhide the WPQRStyle
			count=0;
			while(document.getElementById("WPQRStyle_"+count)){
				document.getElementById("WPQRStyle_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQREmail
			count=0;
			while(document.getElementById("WPQREmail_"+count)){
				document.getElementById("WPQREmail_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRImageSize
			count=0;
			while(document.getElementById("WPQRImageSize_"+count)){
				document.getElementById("WPQRImageSize_"+count).style.display="block";
				count++;
			}
		}
		// Now unhide what we need
		if (qrtype == "phone")
		{
			// display the fields that we need for phone
			// Unhide the WPQRStyle
			count=0;
			while(document.getElementById("WPQRStyle_"+count)){
				document.getElementById("WPQRStyle_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRTelephone
			count=0;
			while(document.getElementById("WPQRTelephone_"+count)){
				document.getElementById("WPQRTelephone_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRImageSize
			count=0;
			while(document.getElementById("WPQRImageSize_"+count)){
				document.getElementById("WPQRImageSize_"+count).style.display="block";
				count++;
			}
		}
		// Now unhide what we need
		if (qrtype == "sms")
		{
			// display the fields that we need for sms
			// Unhide the WPQRStyle
			count=0;
			while(document.getElementById("WPQRStyle_"+count)){
				document.getElementById("WPQRStyle_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRTelephone
			count=0;
			while(document.getElementById("WPQRTelephone_"+count)){
				document.getElementById("WPQRTelephone_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRInfo
			count=0;
			while(document.getElementById("WPQRInfo_"+count)){
				document.getElementById("WPQRInfo_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRImageSize
			count=0;
			while(document.getElementById("WPQRImageSize_"+count)){
				document.getElementById("WPQRImageSize_"+count).style.display="block";
				count++;
			}
		}
		// Now unhide what we need
		if (qrtype == "text")
		{
			// display the fields that we need for text
			// Unhide the WPQRStyle
			count=0;
			while(document.getElementById("WPQRStyle_"+count)){
				document.getElementById("WPQRStyle_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRInfo
			count=0;
			while(document.getElementById("WPQRInfo_"+count)){
				document.getElementById("WPQRInfo_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRImageSize
			count=0;
			while(document.getElementById("WPQRImageSize_"+count)){
				document.getElementById("WPQRImageSize_"+count).style.display="block";
				count++;
			}
		}
		// Now unhide what we need
		if (qrtype == "website")
		{
			// display the fields that we need for website
			// Unhide the WPQRStyle
			count=0;
			while(document.getElementById("WPQRStyle_"+count)){
				document.getElementById("WPQRStyle_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRWebsite
			count=0;
			while(document.getElementById("WPQRWebsite_"+count)){
				document.getElementById("WPQRWebsite_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRImageSize
			count=0;
			while(document.getElementById("WPQRImageSize_"+count)){
				document.getElementById("WPQRImageSize_"+count).style.display="block";
				count++;
			}
		}

		// Now unhide what we need
		if (qrtype == "geo")
		{
			// display the fields that we need for website
			// Unhide the WPQRStyle
			count=0;
			while(document.getElementById("WPQRStyle_"+count)){
				document.getElementById("WPQRStyle_"+count).style.display="block";
				count++;
			}
//			// Unhide the WPQRLongitude
//			count=0;
//			while(document.getElementById("WPQRLongitude_"+count)){
//				document.getElementById("WPQRLongitude_"+count).style.display="block";
//				count++;
//			}
//			// Unhide the WPQRLatitude
//			count=0;
//			while(document.getElementById("WPQRLatitude_"+count)){
//				document.getElementById("WPQRLatitude_"+count).style.display="block";
//				count++;
//			}
			// Unhide the WPQRLocation
			count=0;
			while(document.getElementById("WPQRLocation_"+count)){
				document.getElementById("WPQRLocation_"+count).style.display="block";
				count++;
			}
			// Unhide the WPQRMap
		//me	count=0;
		//me 	while(document.getElementById("WPQRMap_"+count)){
		//me 		document.getElementById("WPQRMap_"+count).style.display="block";
		//me 	count++;
		//me	}
			document.getElementById("map_canvas").style.display="block";

			// Unhide the WPQRImageSize
			count=0;
			while(document.getElementById("WPQRImageSize_"+count)){
				document.getElementById("WPQRImageSize_"+count).style.display="block";
				count++;
			}
			// Initialise the map
			WPQRInitMap()
		}
		
		


}

function WPQRInitMap(){
			// Initialise the map
			zoomLevelstr = document.getElementById("WPQRZoom").value;
			if ( isNaN(parseInt(zoomLevelstr))  ){
				zoomLevel = 4;
			}
			else {
				zoomLevel = parseInt(zoomLevelstr);
			}
			WPQRLatitudestr = document.getElementById("WPQRLatitude").value;
			if ( isNaN(parseFloat(WPQRLatitudestr))  ){
				startLatitude = 38.89774858694348;
			}
			else {
				startLatitude = parseFloat(WPQRLatitudestr);
			}
			WPQRLongitudestr = document.getElementById("WPQRLongitude").value;
			if ( isNaN(parseFloat(WPQRLongitudestr))  ){
				startLongitude = 38.89774858694348;
			}
			else {
				startLongitude = parseFloat(WPQRLongitudestr);
			}
			gmps_initialize(zoomLevel,startLatitude,startLongitude);
	//
}


// copy the email address into the contact email address
// only do this if the contact email address is empty
function copyEmail(){
	//
	if ((document.getElementById("WPQRContactEmail").value.length==0) ||(document.getElementById("WPQRContactEmail").value==null)) 
	{
		document.getElementById("WPQRContactEmail").value = document.getElementById("WPQREmail").value;
	}
}

