/**
****************************************************************************
*

    * Copyright                  :   PuzzleCommerce 2002-2007 by Advanced Millennium  Technologies Pvt. Ltd.
    * Description                :   for the general Taroby functions        
    * File-ID                    :   
    * Author                     :   Anjaly Kiron
    * Date of Creation			 :   06-05-2008 
    * Date of Modification		 :   
    * Modified by                :  Anjaly kiron <anjaly@amtindia.co.in>
    * Modified for               :   
     
*
****************************************************************************
*/
/*if they choose Enquiry Type
SUPPORT ENQUIRY, give another listbox where you bring "Bug Report" and "Feature Request"
PRESS & MEDIA =The field "company" change the label to "Publication". add a row "Check this box for receiving our periodic press releases". also ask for phone number
PARTNERSHIP = Ask for phone number field
JOBS / RECRUITMENT = company field replace with "Current Employer". ask for address and phone number fields also
*/
AddFields=function(selectedoption){
	if(selectedoption=='Customer Support'){
		dojo.byId("customersupport").style.display="";
		dojo.byId("companyname").style.display="";
		dojo.byId("publication").style.display="none";
		dojo.byId("contactnumber").style.display="none";
		dojo.byId("currentemployer").style.display="none";
	}else if(selectedoption=='Press & Media'){
		dojo.byId("customersupport").style.display="none";
		dojo.byId("companyname").style.display="none";
		dojo.byId("currentemployer").style.display="none";
		dojo.byId("publication").style.display="";
		dojo.byId("contactnumber").style.display="";
	}else if(selectedoption=='Partnership'){
		dojo.byId("customersupport").style.display="none";
		dojo.byId("currentemployer").style.display="none";
		dojo.byId("publication").style.display="none";
		dojo.byId("contactnumber").style.display="";
		dojo.byId("companyname").style.display="";
	}else if(selectedoption=='Jobs / Recruitment'){
		dojo.byId("customersupport").style.display="none";
		dojo.byId("companyname").style.display="none";
		dojo.byId("publication").style.display="none";
		dojo.byId("currentemployer").style.display="";
		dojo.byId("contactnumber").style.display="";
	}else{
		dojo.byId("customersupport").style.display="none";
		dojo.byId("companyname").style.display="";
		dojo.byId("publication").style.display="none";
		dojo.byId("contactnumber").style.display="none";
		dojo.byId("currentemployer").style.display="none";
	}

}

ValidateFormValues=function(){
	dojo.byId("hidValAction").value="sendmail";
	msg=dojo.byId("frmContactUs").getAttribute('fieldsEmpty');
	//email validation regular expresssion
	var emailValid = (new RegExp("^(" + amt.app.regexp.emailAddress({}) + ")$")).test(dojo.byId('youremail').value);
	if(!emailValid || dojo.byId('subject').value=="" || dojo.byId('firstname').value=="" || dojo.byId('yourmessage').value==""){
		alert(msg);
		return false;
	}else{
		return true;
	}
}

contactusUploaded=function(a,b,c,d){

	//dojo.byId("attach_img").style.visibility = "visible";
	var tblRef=dojo.byId("contactus");

	// no of rows table has
	var row_num = tblRef.rows.length;
     
	// create new row
	var new_row = tblRef.insertRow( row_num );
	new_row.insertCell(0);
	new_row.insertCell(1);
	new_row.insertCell(2);
	new_row.insertCell(3);
	//new_row.insertCell(4);
	new_row.cells[0].innerHTML="<a href=\"#\">"+a+"</a>";
	new_row.cells[1].innerHTML="&#160;";
	new_row.cells[2].innerHTML="&#160;";
	//new_row.cells[3].innerHTML="&#160;";

	 //  new_row.cells[3].innerHTML="<img src=\"files/images/x.gif\" onclick=\"DeleteAttachment(event);\" height=\"16\" width=\"16\"/><input type=\"hidden\"id=\"attachments\" name=\"attachments[]\" value=\""+encodeURIComponent(a)+"\">";
	new_row.cells[3].innerHTML="<img src=\"files/themes/jinx/images/362.gif\" class=\"image-upload\" onclick=\"DeleteAttachment1(event);\" height=\"16\" width=\"16\"/><input type=\"hidden\" name=\"uploadedfiles[]\" value=\""+encodeURIComponent(a)+"\">";
}

DeleteAttachment1=function(el){
	var tr=el.target.parentNode.parentNode;
	var td=el.target.parentNode;
	var arr=el.target.nextSibling.value;
	var fname=arr;
	//SendRequest(request);
	dojo._destroyElement(tr);
	delete tr;
}

/*
########################################################################
##########
#
# (c) 2002-2007 by Advamced Millennium Technologies Pvt. Ltd. / PuzzleCommerce
#
# Diese Software ist urheberrechtlich geschutzt. 
# Es ist verboten, den Source Code zu entschlusseln oder zu veranden,
# sowie die Software mehr als lizensiert zu nutzen. 
# Zuwiderhandlungen werden strafrechtlich verfolgt.
#
########################################################################
###########
*/