//*********************************************************************
// File Name               : common_script.js
// Scope Of Program        : validation script for  blank, numeric,
//			     alpha-numeric,email id form field.
// Created On              : 10/03/2004
// Modified On             : 11/03/2004
// Modified On             : 05/02/2009	 -- add left menu function
// Reason of Modification  : Add date validation function
// Special Remark          :
//*********************************************************************

	/* 
		Function to open pop window
		Page = paymentdetail.php
	*/
	function openPopupWindow(path, name, wd, hgt, return_win_ref, menubar, resizable, scrollbars, titlebar, toolbar, alwaysRaised) 
	{	
		for (var i=arguments.length; i<openPopupWindow.length; i++) 
		{
			if (typeof(arguments[i]) == "undefined" && i == 7) 
			{
				arguments[i] = "yes";
				
			}	// if (typeof(arguments[i]) == "undefined" && i == 7) 
			else 
			{
				arguments[i] = "no";
				
			}	// if (typeof(arguments[i]) == "undefined" && i == 7)  -- else
			
		}	// for (var i=arguments.length; i<openPopupWindow.length; i++) 		
			
		var win_parameter = 'width=' + arguments[2] + ', height=' + arguments[3] + ', menubar=' + arguments[5] + ', resizable=' + arguments[6] + ', scrollbars=' + arguments[7] + ', titlebar=' + arguments[8] + ', toolbar=' + arguments[9] + ', alwaysRaised=' + arguments[10];
		
		var win_obj = window.open(path, name, win_parameter);	
		
		if (return_win_ref)	
		{
			return win_obj;
		}	// if (return_win_ref)	
		
	}	// function openPopupWindow()




/* 
	Function to validate userLogin
	Page = userLogin.php,  
			login.php
*/
function func_validate_Login(frm)
{
	var msg = "";
	var EmailRegEe = /^[a-zA-Z0-9_\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/i;
	var email = frm.email.value;
	var pass = frm.pass.value;
	
	if( email=='' ) 
	{
		msg = msg+"- Please enter username. \n ";
	}
	else
	{
		if (!email.match(EmailRegEe) ) msg = msg+"- Please Enter valid email address. \n";
	}
	
	if( pass=='' ) msg = msg+"- Please enter password. \n ";
	if( msg!="" )
	{
		alert("The following error(s) occurred: \n" + msg);
		return false;

	}	// if( msg!="" )
	else
	{
		frm.submit();			

	}	// if( msg!="" ) -- else

}	// function func_validate_Login(frm)


/* 
	Function to call billind form 
	Page = shippingdetails2db.php
*/
function func_bill_details_section(shipto_id)
{
	if( shipto_id!=null )
	{
		//document.frmShipDetails_hidden.method="post";
		//document.frmShipDetails_hidden.action="billingdetails.php";
		document.frmShipDetails_hidden.ship_to_id.value= shipto_id;
		document.frmShipDetails_hidden.submit(); 					

	}	// if( shipto_id!=null )
	
}	// function func_bill_details_section(shipto_id)


/* 
	Function to Billing Form
	Page = billingdetails.php
*/
function func_loadBillingForm(purpose,value)
{
	if( purpose!=null )
	{
		if( value!=null )
		{
			var account_id = document.frmBillDetails_hidden.account_id.value;
			var div_name = "#div_"+purpose+"_form";
			if( value=="different" )
			{			
				$(div_name).html("<div align='center'><br><br><img src='images/loading.gif'></div>");

				$.post('shipBillForm.php', { purpose:purpose, value:value, account_id:account_id },
					function(data)
					{
						$(div_name).html(data);
					}
					);		
					return false;
					
			}	// if( value=="different" )
			else
			{
				$(div_name).html("<div align='center'><br><br><img src='images/loading.gif'></div>");			
				$(div_name).html("<div class=\"rowsep\"><label>&nbsp;</label><input src=\"images/btn_proceedtopay.jpg\" type=\"image\" onclick=\"func_insert_same_address();\"></div>");			

			}	// if( value=="different" ) -- else
		
		}	// if( value!=null )

	}	// if( purpose!=null )

}	// function func_loadBillingForm(value)


/* 
	Function to Insert billing details as same as shipping details
	Page = billingdetails.php
*/
function func_insert_same_address()
{
	document.frmBillDetails.method="post";
	document.frmBillDetails.action="billingsdetails2db.php";
	document.frmBillDetails.submit(); 					


}	// function func_insert_same_address()


/* 
	Function to Load City Satae
	Page = countryCityState.php
*/
function func_loadCity(purpose,country,city,other_city)
{
	if( country!=null )
	{
		var div_name = "#"+purpose+"_city";

		$(div_name).html("<div align='center'><br><br><img src='images/loading.gif'></div>");

		$.post('city.php', { purpose:purpose, country:country, city:city, other_city:other_city },
			function(data)
			{
				$(div_name).html(data);
			}
			);		
			return false;


	}	// if( country!=null )

}	// function func_loadCity(country)


/* 
	Function to Validate city
	Page = cityState.php
*/
function func_otherCity(purpose,city,other_city)
{
	if( city!=null )
	{
		var div_name = "#"+purpose+"_other_city";		
	
		$(div_name).html("<div align='center'><br><br><img src='images/loading.gif'></div>");

		$.post('otherCity.php', { purpose:purpose, city:city, other_city:other_city },
			function(data)
			{
				$(div_name).html(data);
			}
			);		
			return false;
		
	}	// if( city!=null )

}	// function func_otherCity(purpose,city)

/* Function to Show and Hide Left Menu */
/* Page = left.php */
function func_LM_ShowHideChild(div_id, parent_series)
{

	if( div_id!=null )
	{
		var div_child="#child_"+div_id;
		var arr_parent_id = parent_series.split("~~");
		
		// close all open menu first
		for(i=0;i<=arr_parent_id.length-1;i++)
		{
			if( arr_parent_id[i]!=div_id )
			{
				if( !$('#child_'+arr_parent_id[i]).is(":hidden") ) $('#child_'+arr_parent_id[i]).slideUp("medium");
			
			}	// if( arr_parent_id[i]!=div_id )

		}	// for(i=0;i<=arr_parent_id.length-1;i++)

		if( $(div_child).is(":hidden") ) 
		{
			$(div_child).slideDown("medium");
		}
		else
		{
			$(div_child).slideUp("medium");
		}

	}	// if( div_id!=null )

}	// function func_LM_ShowHideChild(div_id, parent_series)


/* Function to display full menu items */
function func_left_menu_open(product_id)
{
	if( product_id!=null )
	{
		var div_name="#div_"+product_id;

		$(div_name).html("<div align='center'><br><br><img src='images/loading.gif'></div>");

		$.post('leftdetails.php', { product_id:product_id },
			function(data)
			{
				$(div_name).html(data);
			}
			);		
			return false;

	}	// if( product_id!=null )

}	// function func_left_menu()

/* Function to display full menu items */
function func_view_alls(productid,limit)
{
//	alert(productid+ " = "+limit);

	if( productid!=null )
	{
		var div_name="#div_"+productid;

		$(div_name).html("<div align='center'><br><br><img src='images/loading.gif'></div>");

		$.post('relatedproducts.php', { productid:productid, limit:limit },
			function(data)
			{
				$(div_name).html(data);
			}
			);		
			return false;

	}	// if( product_id!=null )

}	// function func_left_menu()

function func_view_all(productid)
{
	if( productid!=null )
	{
		var div_name="#div_"+productid;

		$(div_name).html("<div align='center'><br><br><img src='images/loading.gif'></div>");

		$.post('relatedproduct.php', { productid:productid, limit:limit },
			function(data)
			{
				$(div_name).html(data);
			}
			);		
			return false;

	}	// if( product_id!=null )

}	// function func_left_menu()



	/* 
		Function to validate shipping and billing detail section 
		Page = userShipBillForm.php
	*/
	function func_userShipBill_validate()
	{	
		var alert_space="";
		var msgShip = "";
		var msgBill = "";

		var frm=document.register_form;
		
		/* ===================================== SHIP ===================================== */
		var ship_title=frm.ship_title.value;
		var ship_name=frm.ship_name.value;
		var ship_dob_dd=frm.ship_dob_dd.value;
		var ship_dob_mm=frm.ship_dob_mm.value;
		var ship_dob_yyyy=frm.ship_dob_yyyy.value;
		var ship_address=frm.ship_address.value;
		var ship_country=frm.ship_country.value;
		var ship_state=frm.ship_state.value;
		var ship_city=frm.ship_city.value;
		var ship_other_city=frm.ship_other_city.value;
		var ship_postal_code=frm.ship_postal_code.value;
		var ship_isd=frm.ship_isd.value;
		var ship_std=frm.ship_std.value;
		var ship_phone=frm.ship_phone.value;
		var ship_mobile=frm.ship_mobile.value;
		var ship_email=frm.ship_email.value;
		
		/* ===================================== BILL ===================================== */	
		var bill_title=frm.bill_title.value;		
		var bill_name=frm.bill_name.value;
		var bill_dob_dd=frm.bill_dob_dd.value;
		var bill_dob_mm=frm.bill_dob_mm.value;
		var bill_dob_yyyy=frm.bill_dob_yyyy.value;
		var bill_address=frm.bill_address.value;
		var bill_country=frm.bill_country.value;
		var bill_state=frm.bill_state.value;
		var bill_city=frm.bill_city.value;
		var bill_other_city=frm.bill_other_city.value;
		var bill_postal_code=frm.bill_postal_code.value;
		var bill_isd=frm.bill_isd.value;
		var bill_std=frm.bill_std.value;
		var bill_phone=frm.bill_phone.value;
		var bill_mobile=frm.bill_mobile.value;
		var bill_email=frm.bill_email.value;

		/* ===================================== SHIP ===================================== */
		if( ship_title=='' ) msgShip = msgShip+"- Please select title. \n ";	
		if( ship_name=='' ) msgShip = msgShip+"- Please enter name. \n ";
		if( ship_dob_dd == "" || ship_dob_mm == "" || ship_dob_yyyy == "") msgShip = msgShip+"- Please select date of birth. \n ";			 

		if (ship_dob_dd != "" && ship_dob_mm != "" && ship_dob_yyyy != "")	
		{
			var ship_dob=ship_dob_mm +"/"+ ship_dob_dd +"/" + ship_dob_yyyy;			

			var DOBRegEe = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;			
			if (!ship_dob.match(DOBRegEe) ) msgShip = msgShip+"- Date of Birth selected is not valid. \n ";			

		}	// if (ship_dob_dd != "" && ship_dob_mm != "" && ship_dob_yyyy != "")	
	
		if( ship_address=='' ) msgShip = msgShip+"- Please enter Address. \n ";								
		
		if( ship_country=='' ) msgShip = msgShip+"- Please select country. \n ";		

		if( ship_country!='' ) 
		{
			if( ship_country=="India|~~|91" || ship_country=="india|~~|91" ) 
			{
				if( ship_state=='' ) msgShip = msgShip+"- Please select state. \n ";															
			
				if( ship_city=='' ) msgShip = msgShip+"- Please select city. \n ";	

				if( ship_city!='' ) 
				{
					if( ship_city=="others|~~|0" || ship_city=="Others|~~|0" ) 
					{
						if( ship_other_city=='' ) msgShip = msgShip+"- Please enter other city. \n ";		

					}	// if( ship_city=="others|~~|0" || ship_city=="Others|~~|0" ) 		

				}	// if( ship_city!='' ) 

			}	// if( ship_country=="India|~~|91" || ship_country=="india|~~|91" ) 
			else
			{
				if( ship_other_city=='' ) msgShip = msgShip+"- Please enter other city. \n ";		

			}	// if( ship_country=="India|~~|91" || ship_country=="india|~~|91" )  -- else

		}	// if( ship_country!='' ) 

		if( ship_postal_code=='' ) msgShip = msgShip+"- Please enter postal code. \n ";				
		if( ship_isd=='' ) msgShip = msgShip+"- Please enter ISD code. \n ";				
		if( ship_std=='' ) msgShip = msgShip+"- Please enter STD code. \n ";				
		if( ship_phone=='' ) msgShip = msgShip+"- Please enter phone number. \n ";									
		if( ship_mobile=='' ) msgShip = msgShip+"- Please enter mobile number. \n ";														
		if( ship_mobile.length < 10 )	msgShip = msgShip+"- Please enter valid mobile number. \n ";							
		if( ship_email=='' ) msgShip = msgShip+"- Please enter email address. \n ";			

		if( ship_email!='' )
		{
			var EmailRegEe = /^[a-zA-Z0-9_\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/i;
			if (!ship_email.match(EmailRegEe) ) msgShip = msgShip+"- Please enter valid email address. \n ";		

		}	// if( ship_email!='' )


		/* ===================================== BILL ===================================== */
		if( bill_title=='' ) msgBill = msgBill+"- Please select title. \n ";	
		if( bill_name=='' ) msgBill = msgBill+"- Please enter name. \n ";
		if( bill_dob_dd == "" || bill_dob_mm == "" || bill_dob_yyyy == "" ) msgBill = msgBill+"- Please select date of birth. \n ";			 

		if (bill_dob_dd != "" && bill_dob_mm != "" && bill_dob_yyyy != "")	
		{
			var bill_dob=bill_dob_mm +"/"+ bill_dob_dd +"/" + bill_dob_yyyy;

			var DOBRegEe = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
			if (!bill_dob.match(DOBRegEe) ) msgBill = msgBill+"- Date of Birth selected is not valid. \n ";			

		}	// if (bill_dob_dd != "" && bill_dob_mm != "" && bill_dob_yyyy != "")	
	
		if( bill_address=='' ) msgBill = msgBill+"- Please enter Address. \n ";								
		
		if( bill_country=='' ) msgBill = msgBill+"- Please select country. \n ";		

		if( bill_country!='' ) 
		{
			if( bill_country=="India|~~|91" || bill_country=="india|~~|91" ) 
			{
				if( bill_state=='' ) msgBill = msgBill+"- Please select state. \n ";															
			
				if( bill_city=='' ) msgBill = msgBill+"- Please select city. \n ";	

				if( bill_city!='' ) 
				{
					if( bill_city=="others|~~|0" || bill_city=="Others|~~|0" ) 
					{
						if( bill_other_city=='' ) msgBill = msgBill+"- Please enter other city. \n ";		

					}	// if( bill_city=="others|~~|0" || bill_city=="Others|~~|0" ) 		

				}	// if( bill_city!='' ) 

			}	// if( bill_country=="India|~~|91" || bill_country=="india|~~|91" ) 
			else
			{
				if( bill_other_city=='' ) msgBill = msgBill+"- Please enter other city. \n ";		

			}	// if( bill_country=="India|~~|91" || bill_country=="india|~~|91" )  -- else

		}	// if( bill_country!='' ) 

		if( bill_postal_code=='' ) msgBill = msgBill+"- Please enter postal code. \n ";				
		if( bill_isd=='' ) msgBill = msgBill+"- Please enter ISD code. \n ";				
		if( bill_std=='' ) msgBill = msgBill+"- Please enter STD code. \n ";				
		if( bill_phone=='' ) msgBill = msgBill+"- Please enter phone number. \n ";									
		if( bill_mobile=='' ) msgBill = msgBill+"- Please enter mobile number. \n ";														
		if( bill_mobile.length < 10 )	msgBill = msgBill+"- Please enter valid mobile number. \n ";							
		if( bill_email=='' ) msgBill = msgBill+"- Please enter email address. \n ";			

		if( bill_email!='' )
		{
			var EmailRegEe = /^[a-zA-Z0-9_\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/i;
			if (!bill_email.match(EmailRegEe) ) msgBill = msgBill+"- Please enter valid email address. \n ";		

		}	// if( bill_email!='' )

		if( msgShip!="" || msgBill!="" )
		{
			var msg_Ship="";
			var msg_Bill="";

			if( msgShip!="" ) msg_Ship="The following error(s) occurred in shipping section: \n" + msgShip;
			if( msgShip!="" ) alert_space="\n\n";
			if( msgBill!="" ) msg_Bill="The following error(s) occurred in billing section: \n" + msgBill;

			alert(msg_Ship+alert_space+msg_Bill);

			return false;		

		}	// if( msgShip!="" || msgBill!="" )
		else
		{
			frm.submit();

		}	// if( msgShip!="" || msgBill!="" )


	}	// function func_userShipBill_validate(purpose)


	/* 
		Function to server side validation for ship and bill 
		Page = common_script.js
	*/
	function func_userShipBill_server_validate() 
	{
		var frm=document.register_form;
		var div_name="";		

		/* ===================================== SHIP ===================================== */
		var ship_title=frm.ship_title.value;
		var ship_name=frm.ship_name.value;
		var ship_dob="";
		var ship_dob_dd=frm.ship_dob_dd.value;
		var ship_dob_mm=frm.ship_dob_mm.value;
		var ship_dob_yyyy=frm.ship_dob_yyyy.value;
		var ship_address=frm.ship_address.value;
		var ship_country=frm.ship_country.value;
		var ship_state=frm.ship_state.value;
		var ship_city=frm.ship_city.value;
		var ship_other_city=frm.ship_other_city.value;
		var ship_postal_code=frm.ship_postal_code.value;
		var ship_isd=frm.ship_isd.value;
		var ship_std=frm.ship_std.value;
		var ship_phone=frm.ship_phone.value;
		var ship_mobile=frm.ship_mobile.value;
		var ship_email=frm.ship_email.value;

		ship_dob=ship_dob_dd+"-"+ship_dob_mm+"-"+ship_dob_yyyy;

		/* ===================================== BILL ===================================== */	
		var bill_title=frm.bill_title.value;		
		var bill_name=frm.bill_name.value;
		var bill_dob="";	
		var bill_dob_dd=frm.bill_dob_dd.value;
		var bill_dob_mm=frm.bill_dob_mm.value;
		var bill_dob_yyyy=frm.bill_dob_yyyy.value;
		var bill_address=frm.bill_address.value;
		var bill_country=frm.bill_country.value;
		var bill_state=frm.bill_state.value;
		var bill_city=frm.bill_city.value;
		var bill_other_city=frm.bill_other_city.value;
		var bill_postal_code=frm.bill_postal_code.value;
		var bill_isd=frm.bill_isd.value;
		var bill_std=frm.bill_std.value;
		var bill_phone=frm.bill_phone.value;
		var bill_mobile=frm.bill_mobile.value;
		var bill_email=frm.bill_email.value;

		bill_dob=bill_dob_dd+"-"+bill_dob_mm+"-"+bill_dob_yyyy;

	}	// function func_userShipBill_server_validate()

/* Function to display java Popup for calendar */
function javaCal(fld)
{
	/* Name		: javaCal						 */
	/* Purpose	: Creates a popup Window for selecting the date. The
			  selected date is set in the textfield.		 */
	/* Inputs	: fld = textfield for setting the date			 */
	/* Outputs	: Calendar Popup					 */
	/* Calls	: calnav.htm						 */
	/* Called By	: 							 */


	tmp_dt_today= new Date();
	tmp_str_dt  = tmp_dt_today.getDate();
        tmp_str_mon = tmp_dt_today.getMonth();
        tmp_str_yr  = tmp_dt_today.getFullYear();

	var tmp_dt_timeStamp  = new Date(tmp_str_yr,tmp_str_mon,tmp_str_dt,0,0,0);
	var tmp_int_todaySecs = Date.parse(tmp_dt_timeStamp);

	/* allowPast = 1 allows selection of past dates
	   allowPast = 0 does not allow selection of past dates
	*/

	doc = "calnav.htm?frmField="+fld+"&tmp_int_todaySecs="+tmp_int_todaySecs+"&allowPast=1";
	window.open(doc,"Calendar","toolbar=0, location=0,directories=0,resizable=no,status=0,menubar=0,scrollbars=no,width=275,height=275,screenX=0,screenY=0");

}

//************** function restricts user from entering blank string and
// from entering only white speces.*****************

function isBlank(tmp_str)
{
// Name      : isBlank.

// Purpose   : keeping validation for blank field.

// Inputs    : tmp_str -> string for validation

// Outputs   : return the value of veriable newString.
//             if newString = "" returns null

var newString  = ''; //trim value of given string
var substring  = ''; // temporary string for checking white spaces in string.
beginningFound = false; // position of white space

// copy characters over to a new string
// retain whitespace characters if they are between other characters

for (var i = 0; i < tmp_str.length; i++)
 {
	// copy non-whitespace characters
	// hold whitespace characters in a temporary string if they follow a non-whitespace character

	if (tmp_str.charAt(i) != ' ' && tmp_str.charCodeAt(i) != 9)
	{
		// if the temporary string contains some whitespace characters, copy them first
		if (substring != '')
		{
			newString += substring;
			substring = '';
		}
		newString += tmp_str.charAt(i);
		 if (beginningFound == false)
		 {
		   beginningFound = true;
		 }
	}

	else if (beginningFound == true)
	{
	   substring += tmp_str.charAt(i);
	}
  }

  return newString;

}

//************** function for allowing only Alpha-Numeric String *****************

function isAlphaNumeric(tmp_str)
{
  // Name      : isAlphanumeric.

  // Purpose   : allow user to enter only Alpha(A-Z)-Numeric(0-9) values.
  // Inputs    : tmp_str -> string for validations.
  // Outputs   : return 1 -> if form field is alphanumeric
  //		 return -1 -> if form field is not alphanumeric

//ignore validation if tmp_str is blank.
if(tmp_str != "")
 {
  // searching whole string word by word
    if (tmp_str.search)
      {
        //checking the words in string.
        //  if string contains the non Alpha-Nemeric value, return -1.
        //  else return 1.

	 if ((tmp_str.search(/[^\w\s]/) != -1) || (tmp_str.search(/\W/) != -1))
	  {
	 	return -1;
	  }
      }
 }
 return 1;
}


//************** function for allowing only Numeric String *****************

function isNumeric(tmp_int)
{
	
  // Name      : isNumeric.

  // Purpose   :allow user to enter only Numeric(0-9) values.
  // Inputs    : tmp_int -> string for validations.
  // Outputs   : return 1 -> if form field is Numeric
  //		 return -1 -> if form field is not Numeric

//ignore validation if tmp_int is blank.

if(tmp_int != "")
 {
   // searching whole string word by word
    if (tmp_int.search)
     {
        //checking the words in string.
        //  if string contains the non Nemeric value, return -1.
        //  else return 1.

	if (tmp_int.search((/[^\d]/)) != -1)
	{
		return -1;
	}
     }
 }
 return 1;
}

//************** function for allowing only Numeric String *****************
function isEmailId(tmp_str)
{
  // Name      : isEmailId.
  // Purpose   : allow user to enter value in email id format(xxx@kk.com).
  // Inputs    : tmp_str -> string for validation.
  // Outputs   : return 1 -> if form field is as email id format.
  //		 return -1 -> if form field is not as email id format.


//ignore validation if tmp_str is blank.

if(tmp_str != "")
  {
     // searching whole string word by word

       if (tmp_str.search)
        {
          //checking the words in string.
          //  if given string is not in email id format(xxx@zzz.com), return -1.
          //  else return 1.

       	       fsign = tmp_str.indexOf("@");
       	       ssign = tmp_str.indexOf(".");

	       if(fsign <= 0 || ssign <= 0)
	       {
		     return -1;
	       }
        }
  }
 return 1;
}

/********* Function Validate date ***************/

function isDate(dateStr,formatStr)
{

  // Name      : isDate.

  // Purpose   : validate Date.

  // Inputs    : dateStr-> Date Value, formatStr -> format of date.

  // Outputs   : return null -> if user enter enter validate data
  //             else return error text

  // Calls     : buildDate(dateStr,formatStr)
  //             datestr = date value
  //             formatStr = date format


  //calls function for validating date

  var myObj = buildDate(dateStr,formatStr);

  //returns the correct date
  //else returns the appropriate error message

   if (typeof myObj == "object")
   {

   // We got a Date object, so good.

    myObj = "";
    return myObj;
   }
   else
   {

   // We got an error string.

    return myObj;
   }
}

function isFile(tmp_str,fileTyp)
{
  // Name      : isFile.
  // Purpose   : validation for File extention
  // Inputs    : tmp_str -> string for validations.
  //	         fileTyp -> file extention type.
  // Outputs   : return 1 -> if form field is valid
  //		 return -1 -> if form field is unvalid

//ignore validation if tmp_str is blank.
if(tmp_str != "")
 {
	var validExt = "no";
	fileStr   = tmp_str;
	intstrLen = fileStr.length;
	intLoc    = fileStr.lastIndexOf(".");
	extVal    = fileStr.substring(intLoc,intstrLen);
	extVal	  = extVal.toLowerCase();
        valExt    = fileTyp;
	var extArry   = valExt.split('#');
	var maxLng    = extArry.length;

        //alert(maxLng);

	for(i=0;i<maxLng;i++)
	{
	   //alert(extVal);
		if(extArry[i] == extVal)
		{

			validExt  = "yes";
		}
	}
	if(validExt == "no")
	{
	  return -1;
	}
 }
 return 1;
}

//************** Price validation *****************

function isPrice(numval)
{
 itPr = 1;

 //alert("sss");

  num = numval;

  PRLen = num.length;
  Len  = num.lastIndexOf(".");
  Len1  = num.lastIndexOf("-");
  extVal = num.substring(Len,PRLen);

  num = num.toString().replace(/\$|\,/g,'');

  if(isNaN(num))
  num = "0";
  sign = (num == (num = Math.abs(num)));
  num = Math.floor(num*100+0.50000000001);
  cents = num%100;
  num = Math.floor(num/100).toString();
  if(cents<10)
  cents = "0" + cents;
  for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
  num = num.substring(0,num.length-(4*i+3))+','+
  num.substring(num.length-(4*i+3));
  newprice = (num + '.' + cents);
  //alert (newprice);
  //alert(Len1);
  if(newprice == "0.00")
  {
  itPr = 0;
  }

 if((Len != -1)&&(extVal.length > 3))
 {
  itPr  = 0;
 }

 if(Len1 >= 0)
  {
    itPr = 0;
  }

  return itPr;
}

function getPathStr(tmp_str_path)
{
/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  Name  : getPathStr()
  Purpose : To get path of the image for validation Img's width
      & height
  Inputs  : tmp_str_path => path of the file selected for upload
  Outputs : formated path string
  Calls  : None
  Called By :

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/

    /* convert the path to form required for Image object */
    tmp_str_imgStr = new String(tmp_str_path);

    tmp_arr_imgStr =  tmp_str_imgStr.split("\\");

    tmp_str_imgStr = "";
    for(i=0;i< tmp_arr_imgStr.length; i++)
    {
     tmp_str_imgStr += tmp_arr_imgStr[i]+"/";
    }

    tmp_int_len = tmp_str_imgStr.length;
    tmp_str_imgStr = tmp_str_imgStr.substring(tmp_str_imgStr,tmp_int_len-1);

    tmp_str_imgStr = tmp_str_imgStr.replace(":","|");
    tmp_str_imgStr = "file:///"+tmp_str_imgStr;

    return tmp_str_imgStr;
}

function preImg(doc,tmp_str_fld)
{
/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  Name  : preImg()
  Purpose : To create Img obj & check file typ before submitting
          the form.
  Inputs  : form obj
  Outputs : Nothing
  Calls  : getPathStr()
  Called By :

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/
   eval("tmp_str_img = doc."+tmp_str_fld+".value");

   /* get formated path string required for Image object */
   tmp_str_imgStr = getPathStr(tmp_str_img);

   /* create an Image obj & assign the selected image as its source */
   img = new Image();
   img.src = tmp_str_imgStr;
}



function isImage(doc,frmVal,maxWidth,maxHeight)
{
/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  Name         : val_image
  Purpose      : Function to check the image height and weidth
  Inputs       : doc,maxWidth,maxHeight
  Outputs      : retuns error or successfull flag
  Calls        : getPathStr() for getting image path
  Called By    :

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/

tmpRetVal = 1;

/* get formated path string required for Image object */
   tmp_str_imgStr = getPathStr(frmVal);

   /* create an Image obj & assign the selected image as its source */
   img = new Image();
   img.src = tmp_str_imgStr;
   tmp_int_wd = img.width;
   tmp_int_ht = img.height;

   tmp_int_maxWd = maxWidth;
   tmp_int_maxHt = maxHeight;

   /* if Image width is more than tmp_int_maxWd  display error */
   if((tmp_int_wd != tmp_int_maxWd) || (tmp_int_ht != tmp_int_maxHt))
   {
     tmpRetVal = -1;
   }

  return tmpRetVal;
}

//************** function for validation Phone numbers *****************
function isPhoneNo(tmp_str)
{
  // Name      : isPhoneNo
  // Purpose   : allow user to enter value in phone numbers with only "-" and "." .
  // Inputs    : tmp_str -> string for validation.
  // Outputs   : return 1 -> if form field is as phone no format.
  //		 return -1 -> if form field is not as phone no format.

 Chars = "0123456789+-.";
 flag=0;
 
      for (i = 0; i < tmp_str.length; i++)
      {
          // Check that current character is number.
          var c = tmp_str.charAt(i);

          if (Chars.indexOf(c) == -1)
          	flag = 1;
      }      
      if(flag)
      {
	  return true;
      }	  
}

//************** function for validates the form feilds *****************

function validate_form(doc)
{
  //On Error Resume Next;

  // Name      : validate_form.

  // Purpose   : validate the form fields.

  // Inputs    : all form feilds values

  // Outputs   : return true -> if user enter enter validate data
  //             else return false
  //             alert box displays with error message.
  // Calls     : isBlank(tmp_str) -> checks the field is blank or containing
  //		                       only white speces.
  //             isAlphaNemeric(tmp_str) -> checks the feild is Alpha-Nemeric
  //		 isNumeric(tmp_int) -> checks the field is nemeric
  //		 isEmailId(tmp_str) -> checks the field is in email id
  //		                        format(xxx@yyy.com)



 //declearing veriables

 var str;                     // stores error messages.
 var blank_field;             // stores a string of form fields and error lable for
                              // blank validation.
 var numeric_field;           // stores a string of form fields and error lable for
                              // numeric[0-9] validation.
 var AlphaNumeric_field;      // stores a string of form fields and error lable for
                              // Alpha-Numeric[A-Z]and[0-9] validation.
 var email_field;             // stores a string of form fields and error lable for
                              // email[xxx@zz.com] validation.
 var date_field               // stores a string of form date fields and error lable for
                              // date validation
 var file_field;              // stores a string of form file fields and error lable for
                              // date validation valid extentions
 var price_field;             // stores a string of form fields and error lable for
                              // price validation
 var image_field;             // stores a string of image's maximum width and height & name
 
 var phone_field;             // stores a value of phone no
 
 
 			      // of form field and error lable for image validation
 var str_blank_field;         // array in which value of blank_field stored by
                              // comma separating.
 var str_numeric_field;       // array in which value of numeric_field stored by
                              // comma separating.
 var str_alphanumeric_field;  // array in which value of AlphaNumeric_field stored by
                              // comma separating.
 var str_email_field;         // array in which value of email_field stored by
                              // comma separating.
 var str_date_field;          // array in which value of date_field stored by
                              // comma separating.
 var str_file_field;          // array in which value of file_field stored by
                              // comma separating.  allowd file extetions are
 			      // seperated by #.
 var str_price_field;         // array in which value of price_field stored by
                              // comma separating.
 var str_image_field;         // array in which value of image_field stored by
                              // comma separating.
 var arr_phone_field;         // stores a form field details of Phone fields bycomma seperated
 
 var tmp_valFile;             // veriable related with file and image size and width .
  
 tmp_valFile = "";
 
 


/* if form field is not aailable setts the null value **/
  if(typeof doc.js_Blank == "undefined")
  {
    blank_field = "";
  }
  else
  {
    blank_field = doc.js_Blank.value;
  }

  if(typeof doc.js_Numeric == "undefined")
  {
     numeric_field = "";
  }
  else
  {
      numeric_field = doc.js_Numeric.value;
  }

  if(typeof doc.js_AlphaNumeric == "undefined")
  {
      AlphaNumeric_field = "";
  }
  else
  {
      AlphaNumeric_field = doc.js_AlphaNumeric.value;
  }

  if(typeof doc.js_Email == "undefined")
  {
      email_field = "";
  }
  else
  {
      email_field = doc.js_Email.value;
  }


  if(typeof doc.js_Date == "undefined")
  {
      date_field = "";
  }
  else
  {
      date_field = doc.js_Date.value;
  }

  if(typeof doc.js_File == "undefined")
  {
    file_field = "";
  }
  else
  {
    file_field = doc.js_File.value;
  }

 if(typeof doc.js_Price == "undefined")
  {
    price_field = "";
  }
 else
  {
    price_field = doc.js_Price.value;
  }

  if(typeof doc.js_Image == "undefined")
  {
    image_field = "";
  }
 else
  {
    image_field = doc.js_Image.value;
  }
  
 if(typeof doc.js_Phone == "undefined")
  {
    phone_field = "";
  }
 else
  {
    phone_field = doc.js_Phone.value;
  } 

   str = "";

   //calls function is_blank for blank validation, if blank_field is not null

     if(blank_field != "")
     {

       //creats array in which values stores without comma
        str_blank_field = blank_field.split(",");
		//alert("str_blank_field.length " +str_blank_field.length);
        //loop for getting value from array for validating fields.
        for(a=0; a<str_blank_field.length; a++)
         {

            //getting error lables for messages
            tmp_str_FlType = str_blank_field[a];

             a=a+1;
             //alert(tmp_str_FlType);

            //getting field name
             tmp_str_FldName = str_blank_field[a];
			 

            //getting value of form fields
            if(tmp_str_FlType != "mul")
            {
              			 
			  tmp_str_value = eval('document.'+doc.name+'.'+str_blank_field[a]+'.value');
			  
            }
            else
            {
              tmp_str_value = "";
            }
             a=a+1;
			

            //getting error lables for messages
            tmp_err_Mess2 = str_blank_field[a];
			//alert("tmp_err_Mess2 " +tmp_err_Mess2);
           //calls function for blank validation
		   			
             switch(tmp_str_FlType)
			 {
                case 'text':
				{					
                 tmp_Blank_validate = isBlank(tmp_str_value);
				//alert("tmp_Blank_validate"+ tmp_str_value + "  "+tmp_Blank_validate);
                 tmp_str_Mess1 = "Please enter ";
  				 break;
				}
				case 'check':
                 tmp_Blank_validate = "checked";
                 if(eval('document.'+doc.name+'.'+tmp_str_FldName+'.checked') == false)
                 {
                   tmp_Blank_validate = "";
                   tmp_str_Mess1 = "Please check ";
                 }
                break;
                case 'radio':
                 tmp_Blank_validate = "";
                 tmp_str_Mess1 = "Please check ";
                 
                 radiogroup = eval('document.'+doc.name+'.elements[tmp_str_FldName]');
				 
                  for(var r = 0 ; r < radiogroup.length ; ++r)
	           {
					  
	            if(radiogroup[r].checked)
	            {
	              tmp_Blank_validate = "checked";
	            }
	           }
                break;
	        case 'select':
                 tmp_Blank_validate = "selected";
                 if((eval('document.'+doc.name+'.'+tmp_str_FldName+'.selected') == true) || (tmp_str_value == ""))
                 {
                   tmp_Blank_validate = "";
                   tmp_str_Mess1 = "Please select ";
                 }
                break;
			case 'checkarray':
			var valcheck = howManyChecked(doc.name,tmp_str_FldName,'100',1,'Please check ');		
				tmp_Blank_validate = "selected";
					if (parseInt(valcheck)==1)
					{
						//alert(valcheck);					 
					   tmp_Blank_validate = "";
					   tmp_str_Mess1 = "Please check ";
					}
					
			break;
	        case 'mul':
                 tmp_Blank_validate = "selected";
                 mulCnt  = eval('document.'+doc.name+'["'+tmp_str_FldName+'"].length');
                 selMulCnt = 0;
			  /* loop through the selected titles.  */
			  for(m=0; m<mulCnt; m++)
			  {
				tmp_str_value
				if(eval('document.'+doc.name+'["'+tmp_str_FldName+'"]['+m+'].selected') == true)
				{
				  selMulCnt++;
				}
			  }
			  if(selMulCnt == 0)
			  {
				tmp_Blank_validate = "";
					tmp_str_Mess1      = "Please select ";
					  }
					break;
				}
			  //if value of tmp_validate = "", sets the error message.
			  //alert("tmp_Blank_validate = "+tmp_Blank_validate); 
			  if(tmp_Blank_validate == "")
			   {
				  str +=  tmp_str_Mess1 + tmp_err_Mess2 + "\n";
			   }
         }
     }

//calls function isNumeric for numeric validation, if numeric_field is not null

     if(numeric_field != "")
     {
       //creats array in which values stores without comma
       str_numeric_field = numeric_field.split(",");
		//alert("str_numeric_field.length " +str_numeric_field.length);
       //loop for getting value from array for validating fields.
       for(a=0; a<str_numeric_field.length; a++)
       {
         //getting value of form fields
	 tmp_str = eval('document.'+doc.name+'.'+str_numeric_field[a]+'.value');

	  a=a+1;

	 //getting error lables for messages
	 tmp_err_message = str_numeric_field[a];



	   //calls function for Numeric(0-9) validation
	   tmp_validate = isNumeric(tmp_str);
		//alert("tmp_validate = "+tmp_str +" -- "+tmp_validate );
	//if value of tmp_validate = -1 setting error message.
	if(tmp_validate == -1)
	   {
	      str += "Please enter valid " + tmp_err_message + "\n";
	   }
       }
      }

  //calls function isAlphaNumeric for AlphaNumeric validation, if AlphaNumeric_field is not null

      if(AlphaNumeric_field != "")
      {

        //creats array in which values stores without comma
        str_alphanumeric_field = AlphaNumeric_field.split(",");

         //loop for getting value from array for validating fields.
         for(a=0; a<str_alphanumeric_field.length; a++)
          {

            //getting value of form field
            tmp_str = eval('document.'+doc.name+'.'+str_alphanumeric_field[a]+'.value');

            a=a+1;

            //getting error lables for messages
            tmp_err_message = str_alphanumeric_field[a];

           //calls function for Alpha Numeric(A-Z and 0-9)  validation

           tmp_validate = isAlphaNumeric(tmp_str);

          //if value of tmp_validate = -1 setting error message
           if(tmp_validate == -1)
            {
               str += "Please enter valid " + tmp_err_message + "\n";
            }
          }
       }


 //calls function isEmailId for Email Id validation, if email_field is not null


     if(email_field != "")
     {
       //creats array in which values stores without comma
       str_email_field = email_field.split(",");

       //loop for getting value from array for validating fields.
       for(a=0; a<str_email_field.length; a++)
        {

          //getting value of form field
	  tmp_str = eval('document.'+doc.name+'.'+str_email_field[a]+'.value');

	  a=a+1;

	  //getting error lables for messages
	  tmp_err_message = str_email_field[a];



	 //calls function for Email ID(xxx@yyy.com) validation

	 tmp_validate = isEmailId(tmp_str);

	 //if value of tmp_validate = -1 setting error message
	  if(tmp_validate == -1)
	    {
	       str += "Please enter valid " + tmp_err_message + " \n";
            }
        }
     }

      //calls function isDate for Date validation, if date_field is not null

       if(date_field != "")
          {
            //creats array in which values stores without comma
            str_date_field = date_field.split(",");

            //loop for getting value from array for validating fields.
            for(a=0; a<str_date_field.length; a++)
             {

             //getting date format
             tmp_date_format = str_date_field[a];

             a=a+1;

            //getting value of form field
     	    tmp_str = eval('document.'+doc.name+'.'+str_date_field[a]+'.value');

     	    a=a+1;

     	  //getting error lables for messages
     	  tmp_err_message = str_date_field[a];



     	 //calls function for date validation

     	 tmp_validate = isDate(tmp_str,tmp_date_format);

     	 //if value of tmp_validate = -1 setting error message

         if (tmp_str  != "")
         {
     	  if(tmp_validate != "")
     	    {
     	       str += "Please enter "+ tmp_err_message + " in DD-MM-YYYY format. \n";
            }
         }
        }
     }

 //calls function isFile for file extention validation, if file_field is not null

       if(file_field != "")
          {          
           tmp_valFile = "";
            //creats array in which values stores without comma
            str_file_field = file_field.split(",");

            //loop for getting value from array for validating fields.
            for(a=0; a<str_file_field.length; a++)
             {
              //getting file extention format
              tmp_file_extention = str_file_field[a];
              a=a+1;

             //getting value of form field

     	     tmp_str = eval('document.'+doc.name+'.'+str_file_field[a]+'.value');

     	    a=a+1;

     	  //getting error lables for messages
     	  tmp_err_message = str_file_field[a];
     	  
     	 if(tmp_str != "")
     	 {
     	 //calls function for file validation
     	
     	 tmp_validate = isFile(tmp_str,tmp_file_extention);

     	 //alert(tmp_validate);

     	 //if value of tmp_validate = -1 setting error message
     	 
     	  if(tmp_validate == -1)
     	    {     	       
     	       /* Replace the # TAGs with "," */
	       var brk       = new RegExp('#','gi');
	       tmp_file_extention = tmp_file_extention.replace(brk,", ");

     	       str += "please upload "+tmp_file_extention+" extension file for "+tmp_err_message+ "\n";
            }
          else
            {
              tmp_valFile = "done";
            } 
          }  
         }
     }

 //calls function isPrice for Price validation, if price_field is not null

     if(price_field != "")
     {
       //creats array in which values stores without comma
       str_price_field = price_field.split(",");

       //loop for getting value from array for validating fields.
       for(a=0; a<str_price_field.length; a++)
        {
          //getting value of form field
	  tmp_str = eval('document.'+doc.name+'.'+str_price_field[a]+'.value');
	  a=a+1;

	  //getting error lables for messages
	  tmp_err_message = str_price_field[a];

	 //calls function for Price(99.99) validation

	 if(tmp_str != "")
	 {
	   tmp_validate = isPrice(tmp_str);

	 //if value of tmp_validate = 0 setting error message
	  if(tmp_validate == 0)
	    {
	       str += "Please enter "+tmp_err_message+" Price in 9.99(Price) format.\n";
            }
         }

        }
     }

 //calls function isImage for image height and width validation, if image_field is not null

      //alert(tmp_valFile);      

       if((image_field != "") && (tmp_valFile == "done"))
          {
            //creats array in which values stores without comma
            arr_image_field = image_field.split(",");
                       
            //loop for getting value from array for validating fields.
            for(a=0; a<arr_image_field.length; a++)
             {
              //getting the images height and width
              tmp_image_dim = arr_image_field[a];
              a=a+1;

              tmp_arr_dimention = tmp_image_dim.split("#");
              tmp_int_width = tmp_arr_dimention[0];
              tmp_int_height = tmp_arr_dimention[1];

             //getting value of form field
     	     tmp_str = eval('document.'+doc.name+'.'+arr_image_field[a]+'.value');
     	     a=a+1;

     	  //getting error lables for messages
     	  tmp_err_message = arr_image_field[a];
     	  //alert(tmp_err_message);
     	  
     	    if(tmp_str != "")
             {
     	         //calls function for file validation

     	          tmp_validate = isImage(doc,tmp_str,tmp_int_width,tmp_int_height);
     	 
     	          //if value of tmp_validate = -1 setting error message
       
     	          if(tmp_validate == -1)
     	          {
     	            str += tmp_err_message+" image width and height should be "+tmp_int_width+" by "+tmp_int_height+" pixels. \n";
                  }
             }
          } 
     }

//calls function isPhoneNo for validating values for phone numbers
     if(phone_field != "")
     {
       //creats array in which values stores without comma
       arr_phone_field = phone_field.split(",");

       //loop for getting value from array for validating fields.
       for(a=0; a<arr_phone_field.length; a++)
       {
         //getting value of form fields
	 tmp_str = eval('document.'+doc.name+'.'+arr_phone_field[a]+'.value');

	  a=a+1;

	 //getting error lables for messages
	 tmp_err_message = arr_phone_field[a];


	   //calls function for phone no. validation
	   tmp_validate = isPhoneNo(tmp_str);

	//if value of tmp_validate = -1 setting error message.
	if(tmp_validate)
	   {
	      str += "Please enter valid " + tmp_err_message + "\n";
	   }
       }
      }

// if str contains the error messages return false
// else return true

   if(str)
    {
       alert(str);
       return false;
    }
   else
    {
       return true;
    }

}

function howManyChecked(whichForm,whichCheckBoxArray,myMax,myMin,whichQuestion)
/*
  This function takes 5 paramaters:
  whichForm -- the NAME of the form to be validated, a string
  whichCheckBoxArray -- the NAME of the checkbox to be checked, a string
  myMax -- the most you want the user to be able to check, an integer
  myMin -- the least you want the user to be able to check, an integer
  whichQuestion -- a short description of the question, a string
  
  example use:
  howManyChecked('myform','cb_industry',6,1,'Industry');
*/
{
	var _countChecked = 0;
	var err = 0;
	/* iterate through all the elements in the checkbox array */
	for(i=0;i<document[whichForm][whichCheckBoxArray].length;i++)
	{
		/* and check to see if each is checked */
		if(document[whichForm][whichCheckBoxArray][i].checked==true)
			/* if it is, increment a counter */
			{ _countChecked++; }
	}
	/* is the count too high? */
	if(_countChecked > myMax)
		{
		
		//alert('Limit '+myMax+' checks for the '+whichQuestion+' question.');
			err = 1;}
	/* of is the count too low */
	else if(_countChecked < myMin)
		{		
		//alert('You must fill out at least '+myMin+' entry(s) for the '+whichQuestion+' question.');
			err = 1;}
	return 	err;	

}

function show_special_offer(){

	//$('#special_offer_id').html("<div align='center'><br><br><img src='images/busy.gif'></div>");

	$.post('specialoffer.php', {boxtype:11} ,
		function(data)
		{
		//alert(data);
			$('#special_offer_id').html(data);
			//$('#special_offer_id').cycle();
			
			$('#special_offer_id').cycle({ 
    fx:    'fade', 
    speed: 3500 
});

		}
		);		

		return false;

}

function viewforgotpassword()
{
	$.get("forgotpwd.php",function (data){
		$.modal(data,{
			close: false,
			position: ["30%","30%"],
			overlayCss: {
			backgroundColor: '#000',
			cursor: 'wait'
			},
			containerCss: {			
			backgroundColor: '#fff',
			border: '3px solid #ccc'
			}
		});//modal	
	//alert(data);
	});
}