//Country List for Country drop down
var offcolor = "#FFFFFF";
var oncolor = "#FFFFFF";
function fadein(id)
{
	id = "#" + id;
	$(id).fadeIn("medium");
}
function fadeout(id)
{
	id = "#" + id;
	$(id).fadeOut("medium");
}
function slidedown(id)
{
	id = "#" + id;
	$(id).slideDown("medium");
}
function slideup(id)
{
	id = "#" + id;
	$(id).slideUp("medium");
}

function validateregfrm()
{
	var flag = 0;
	if(document.getElementById("field_1").value == "")
	{
		flag = 1;
		new hideerrmsg('field_1_box','field_1_box_errbx');
		new adderrmsg('field_1_box','Please enter your Sending Country');
	}
	else
	{
		
	}
	
	if(flag==1)
	{
		return false;
	}
	else
	{
		return true;
	}
}
function setsuboptn()
{
	new slidedown('typesubopt');
	new slidedown('typesuboptlabel');
	document.getElementById('field_7').length = 0;
	var selectedtype = document.getElementById("field_6").value 
	var subtype = document.getElementById("field_7");
	if(selectedtype == "null")
	{
		new slideup('typesubopt');
		new slideup('typesuboptlabel');		
	}
	if(selectedtype == "Account Related")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Login/Password","Login/Password")
		subtype.options[2]=new Option("A/C Activation","A/C Activation")
		subtype.options[3]=new Option("Registration Related","Registration Related")
		subtype.options[4]=new Option("Others","Others")
	}
	if(selectedtype == "Cancellation - Transaction")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Cancel Transaction","Cancel Transaction")
		subtype.options[2]=new Option("Others","Others")
	}
	if(selectedtype == "Compliance")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Additional Document","Additional Document")
		subtype.options[2]=new Option("Tele-Verification","Tele-Verification")
		subtype.options[3]=new Option("KYC Verification","KYC Verification")
		subtype.options[4]=new Option("Others","Others")
	}
	if(selectedtype == "Foreign Exchange")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Rate applied","Rate applied")
		subtype.options[2]=new Option("Others","Others")
	}
	if(selectedtype == "General")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Payment Modes","Payment Modes")
		subtype.options[2]=new Option("Modes Of credit","Modes Of credit")
		subtype.options[3]=new Option("Process","Process")
		subtype.options[4]=new Option("Others","Others")
	}
	if(selectedtype == "Others")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Services","Services")
		subtype.options[2]=new Option("Techincal","Techincal")
		subtype.options[3]=new Option("Others","Others")
	}
	if(selectedtype == "Product")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Process","Process")
		subtype.options[2]=new Option("Standing Instruction Facility","Standing Instruction Facility")
		subtype.options[3]=new Option("Utility Bill Payment","Utility Bill Payment")
		subtype.options[4]=new Option("Turn Around Time (TAT)","Turn Around Time (TAT)")
		subtype.options[5]=new Option("Currency","Currency")		
		subtype.options[6]=new Option("Others","Others")
	}
	if(selectedtype == "Promotion/Offer")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Registration Offer","Registration Offer")
		subtype.options[2]=new Option("Transaction Offer","Transaction Offer")
		subtype.options[3]=new Option("Delivery","Delivery")
		subtype.options[4]=new Option("Others","Others")
	}
	if(selectedtype == "Service Charges/Fee")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Charges","Charges")
		subtype.options[2]=new Option("More amount deducted","More amount deducted")
		subtype.options[3]=new Option("Others","Others")
	}
	if(selectedtype == "Transaction Related")
	{
		subtype.options[0]=new Option("Select","null")
		subtype.options[1]=new Option("Transaction Concern","Transaction Concern")
		subtype.options[2]=new Option("Status Tracker","Status Tracker")
		subtype.options[3]=new Option("Transaction Closed","Transaction Closed")
		subtype.options[4]=new Option("DD issue","DD issue")
		subtype.options[5]=new Option("Others","Others")
	}
	
}
function setfocus(fieldid)
{
	var obj = document.getElementById(fieldid);
	obj.focus();
	try
	{
		obj.select();	
	}
	catch(e)
	{
	}
}
function changeclass(id,class1)
{
	document.getElementById(id).className = class1;
}
function changetxtbxbrdr(id,onoff)
{
	if(onoff == "on")
	{
		document.getElementById(id).style.border = "#666666 solid 1px";
	}
	else
	{
		document.getElementById(id).style.border = "#cccccc solid 1px";		
	}
}

function ele_hide(id)
{
	document.getElementById(id).style.display = "none"
}
function ele_show(id)
{
	document.getElementById(id).style.display = "block"
}
function changeBG(id,onoff)
{
	var obj = document.getElementById(id);
	if(onoff == "on")
	{
		obj.style.backgroundColor = oncolor;
	}
	else
	{
		obj.style.backgroundColor = offcolor;		
	}
}

function hideerrmsgdelayed(inputid,id)
{
	try
	{
		if(document.getElementById(id))
		{
			var inputid1 = document.getElementById(inputid);
			var childid = document.getElementById(id);
			var rmc = setTimeout(function() { inputid1.removeChild(childid); }, 1500);
			//inputid1.removeChild(childid);
		}
	}
	catch(e)
	{
		//alert(e);
	}
}
function hideerrmsg(inputid,id)
{
	try
	{
		if(document.getElementById(id))
		{
			var inputid1 = document.getElementById(inputid);
			var childid = document.getElementById(id);
			inputid1.removeChild(childid);
		}
	}
	catch(e)
	{
		alert(e);
	}
}

function adderrmsg(inputid,errmsg)
{
  try
  {
  	var inputid1 = document.getElementById(inputid);
	var div1 = document.createElement('div');
	var eleid = inputid + "_errbx"
    div1.id = eleid;
	div1.className = "rrboxdiv"
	div1.setAttribute('id',eleid);
	div1.setAttribute('class','rrboxdiv');	
    inputid1.appendChild(div1);
	div1.innerHTML = "<img src='../cms/images/w2i-sign_error.png' width='12' height='12' align='absmiddle' /> " + errmsg
  }
  catch(e)
  {
	  
  }
}

function validate_email_value(textbox)
{
 var email = textbox.value;
 var flag = new Boolean();
 
 if(email.charAt(0)!="@")
 { 
  for(i=0;i<=email.length-1;i++)
  {
   if(email.charAt(i)=="@")
   {
    for(j=i;j<=email.length-1;j++)
    {
     if(email.charAt(j)==".")
	 {
	  if(email.length-1>j+1)
	  return true;
	 } 
    }
    return add_error_msg("Please enter a valid email address", textbox);
   }
  }
  return add_error_msg("Please enter a valid email address", textbox);
 }
 else
 return add_error_msg("Please enter a valid email address", textbox);
}

function add_error_msg(msg, textbox)
{
	flag = 1;
	//alert("add_error_msg: :flag: "+textbox.name+"_box"  +"" );
	new hideerrmsg(textbox.name+"_box",textbox.name+"_box_errbx"); 
	new adderrmsg(textbox.name+"_box",msg);
	//	alert("add_error_msg::flag3: "+flag);

    //error[e] = msg; 
	//divElementId[e] = getElementById(eval(textbox.name+'_box');
    //e++;
    return false;
}
