function deleteconf1()
{
	var conf=confirm("Are you sure you want to delete Image?");
	if(conf==true)
	{
		return true;
	}
	return false;
}



function checkAll()
{

	var rs = (document.frmlist.abc.checked)?true:false;

	for(i=0;i<document.frmlist.elements.length;i++)
	{
	  	if(document.frmlist.elements[i].id == 'iId')
  		{
			document.frmlist.elements[i].checked = rs;
		}
	}
}

/* 
function checkAll(val)
{
	alert(val);
	var rs = (document.frmlist.abc.checked)?true:false;

	for(i=0;i<document.frmlist.elements.length;i++)
	{
	  	if(document.frmlist.elements[i].id == 'iId')
  		{
			document.frmlist.elements[i].checked = rs;
		}
	}
}
*/
function checkDelete()
{

	var y=0; var ans;
	y = getCheckCount();

	if(y>0)
	{	ans = confirm("Confirm Deletion of Selected Record(s) ?");
		if(ans == true)
		{	
		document.frmlist.method.value="DeleteAll";
              document.frmlist.submit();
		}
		else
		{return false;}
	}
	else
	{	alert("Please Select a Record(s) to Delete.");	return false;	}
}

function getCheckCount()
{	var x=0;

	for(i=0;i < document.frmlist.elements.length;i++)
	{	if (document.frmlist.elements[i].id == 'iId' && document.frmlist.elements[i].checked == true)
			{x++;}
	}
	return x;
}
function checkActive()
{

	var y=0; var ans;
	y = getCheckCount();
	
	if(y>0)
	{	ans = confirm("Confirm Active Status of Selected Record(s) ?");
		if(ans == true)
		{	document.frmlist.method.value="ActiveAll";	
			document.frmlist.submit();
    }
		else
		{	return false;	}
	}
	else
	{	alert("Please Select a Record(s) to Activate.");	return false;	}
}
function checkInActive()
{
	var y=0; var ans;
	y = getCheckCount();
	if(y>0)
	{	ans = confirm("Confirm InActive Status of Selected Record(s) ?");
		if(ans == true)
		{	document.frmlist.method.value="InActiveAll";	
			document.frmlist.submit();		}
		else
		{	return false;	}
	}
	else
	{	alert("Please Select a Record(s) to InActivate.");	return false;	}
}



/*function search()
{
	alert("hello");
	
	if(document.frmlist.cmbSearch.value =="Status" )
 	{
    	document.frmlist.serachtext.value=document.frmlist.txtKeyWord1.value;
	    document.frmlist.method.value="Search";
    	return true;
 	}
	else
	{
    	returnval=isSearchValueExist(document.frmlist.txtKeyWord.value,"Please enter a search keyword");
     	return returnval;
 	}

	if(document.frmlist.cmbSearch.value =="status" )
 	{
    	document.frmlist.serachtext.value=document.frmlist.txtKeyWord1.value;
	    document.frmlist.method.value="Search";
    	return true;
 	}
	else
	{
    	returnval=isSearchValueExist(document.frmlist.txtKeyWord.value,"Please enter a search keyword");
     	return returnval;
 	}
}
*/

function search()
{
document.frmlist.method.value="Search";	

if(document.frmlist.cmbSearch.value =="Status" )
{
	document.frmlist.serachtext.value=document.frmlist.txtKeyWord1.value;
	document.frmlist.method.value="Search";
    return returnval;
}
else if(document.frmlist.cmbSearch.value =="o.status" )
{
	document.frmlist.serachtext.value=document.frmlist.txtKeyWord1.value;
	document.frmlist.method.value="Search";
    return returnval;
}
else if(document.frmlist.cmbSearch.value =="CountryID")
{
 	document.frmlist.serachtext.value=document.frmlist.cmbCountryID.value;
	document.frmlist.method.value="Search";
    return returnval;
    //  returnval=isSearchValueExist(document.frmlist.cmbCountryID.value,"Please Select a country Name");
      //return returnval;
}

else if( document.frmlist.cmbSearch.value =="ServicesID")
{
      returnval=isSearchValueExist(document.frmlist.cmbServicesID.value,"Please Select a services Name");
      return returnval;
}
else if( document.frmlist.cmbSearch.value =="DeliveryID")
{
      returnval=isSearchValueExist(document.frmlist.cmbDeliveryID.value,"Please Select a delivery Name");
      return returnval;
}
else if( document.frmlist.cmbSearch.value =="User_exist")
{
      returnval=isSearchValueExist(document.frmlist.cmbexisting.value,"Please Select a existing status");
      return returnval;
}
else if( document.frmlist.cmbSearch.value =="Subject")
{
      returnval=isSearchValueExist(document.frmlist.cmbSubject.value,"Please Select a Subject");
      return returnval;
}

else if( document.frmlist.cmbSearch.value =="sub_type")
{
      returnval=isSearchValueExist(document.frmlist.cmbSubscribe.value,"Please Select a Subscribe");
      return returnval;
}

else 
{
	var value = document.frmlist.txtKeyWord.value;
	if(value!="")
	{
		returnval=isSearchValueExist(document.frmlist.txtKeyWord.value,"Please enter a Keyword ");
		return returnval;

		}
		else
		{
			alert("Please enter a search keyword");
				//returnval=isSearchValueExist(document.frmlist.txtKeyWord.value,"Please enter a search keyword");
				//return returnval;
				return false;		
		}
	 }
}





function isSearchValueExist(val,message)
{
	if(val == "")
    {
		alert(message);
		return returnval;
//       	return false;
    }
	else
	{
	   	document.frmlist.serachtext.value = val;
       	document.frmlist.method.value="Search";
       	return true;
    }
}


function add_more_upload1(count) 
{
	var new_total = Math.round(document.product_add.TOTAL_FILE.value) + 1;
	
	//alert(count);
	//alert(new_total);

	//alert(count);
	//var new_total = Math.round(document.product_add.TOTAL_FILE.value) + count;

	//var count = Math.round(document.product_add.TOTAL_FILE.value) + 1;

	count = count + new_total;

	//alert(count);

	//alert(count);
	//if(new_total==5)
	if(count>=5)
	{
		alert("You can upload 5 images only");
		//return false;
	}
	else
	{
		//alert(document.getElementById('attach_'  + document.product_add.TOTAL_FILE.value).innerHTML);
		//alert("<input type='file' size='30' class='cstextbox' name='txtproductimage[" +  new_total  + "]' ></p><p id='attach_" + new_total  + "'>");
		document.getElementById('attach_'  + document.product_add.TOTAL_FILE.value).innerHTML = "<input type='file' size='30' class='cstextbox' name='txtproductimage[" +  new_total  + "]'></div><br><div id='attach_" + new_total  + "' style='margin-top:10px'>";
		//document.getElementById('attach_'  + document.product_add.TOTAL_FILE.value).innerHTML = "<input type='file' size='30' class='cstextbox' name='txtproductimage[" +  new_total  + "]' ></p><p id='attach_" + new_total  + "'>";
		//document.getElementById('attach_'  + document.product_add.TOTAL_FILE.value).innerHTML = "<input type='file' size='30' class='cstextbox' name='txtproductimage[" +  new_total  + "]' /></p><p id='attach_" + new_total  + "'>";
		//document.getElementById('attach_'  + document.product_add.TOTAL_FILE.value).innerHTML = "<input type='file' size='30' class='cstextbox' name='txtproductimage[" +  count  + "]' /></p><p id='attach_" + count  + "'>";
		//alert(document.getElementById('attach_'  + document.product_add.TOTAL_FILE.value).innerHTML);
		document.product_add.TOTAL_FILE.value++;
	}
}

function deleteconf1()
{
	var conf=confirm("Are you sure you want to delete Image?");
	if(conf==true)
	{
		return true;
	}
	return false;
}



/*


function search()
{
	//alert(document.frmlist.cmbSearch.value);
	if(document.frmlist.cmbSearch.value == "Catagory Name" )
 	{
    	document.frmlist.serachtext.value=document.frmlist.txtKeyWord1.value;
    	document.frmlist.method.value="Search";
		//alert(document.frmlist.txtKeyWord1.value);
	    return returnval;
 	}
	else if( document.frmlist.cmbSearch.value =="Status")
	{
		document.frmlist.serachtext.value=document.frmlist.txtKeyWord1.value;
		document.frmlist.method.value="Search";
        //alert("select");
       	return returnval;
	}
 	else if(document.frmlist.cmbSearch.value == "FirstName")
	{
		alert("hi");
		document.frmlist.searchchtext.value=document.frmlist.txtKeyWord.value;
		//document.frmlist.method.value="Search";
		//returnval=isSearchValueExist(document.frmlist.txtKeyWord.value,"Please Select a country Name");
		return false;
	}
	else
	{
 	    returnval=isSearchValueExist(document.frmlist.txtKeyWord.value,"Please enter a search keyword");
		returnval=isCountryValueExist(document.frmlist.cmbCountryID.value,"Please select a Country");
		return false;
	}
}


function  isSearchValueExist(val,message)
{    
	if(val == "")
    {
		alert("not found");
    	alert(message);
		return true;
//       	return false;
    }
	else
	{
    	document.frmlist.serachtext.value=val;
	   	//alert(document.frmlist.serachtext.value);
	 	// returnval=isCountryValueExist(document.frmlist.cmbCountryID.value,"Please select a Country");
       	document.frmlist.method.value="Search";
       	return false;
    }
}

*/

function isCountryValueExist(val,message)
{
	if(val=="")
	{
		alert(message);
		return false;
	}else{
		document.frmlist.cid.value=val;
		//alert(document.frmlist.cid.value);
		//returnval=isSearchValueExist(document.frmlist.txtKeyWord.value,"Please enter a search keyword");
		//document.frmlist.method.value="Search";
		return true;
	}
}
function showall()
{
  
document.frmlist.method.value="ShowAll";

}

function comboChange(val){

  if(val=="Status"){
    document.frmlist.txtKeyWord.value="";
    obj=document.all['status'];
    obj.style.display='';
    obj=document.all['keyword'];
    obj.style.display='';
  }else{
    obj=document.all['keyword'];
    obj.style.display='';
    obj=document.all['status'];
    obj.style.display='none';

  }
}

function checkCmbName(val)
{
    obj=document.forms['frmlist'].elements;
    leng=document.forms['frmlist'].length;
	for(i=0;i<leng;i++){
		if(obj[i].name==val)
		return true;
	}
}

//////////////////////////////////////////
/////  Shailesh 19-4-2006 ////////////////
//////////////////////////////////////////
function comboMobileCareer(val){

val=document.forms['frmlist'].elements[val].value;
obj=document.forms['frmlist'].elements;
//alert(val);
if(val=='Subject'){
	obj['txtKeyWord'].style.display='none';
	obj['cmbSubject'].style.display='';
	
    tamp=checkCmbName('cmbCountryID');
	if(tamp==true){
	obj['cmbCountryID'].style.display='none';
	}
	tamp=checkCmbName('cmbDeliveryID');
	if(tamp==true){
	obj['cmbDeliveryID'].style.display='none';
	}
	tamp=checkCmbName('cmbServicesID');
	if(tamp==true){
	obj['cmbServicesID'].style.display='none';
	}
	tamp=checkCmbName('cmbexisting');
	if(tamp==true){
	obj['cmbexisting'].style.display='none';
	}
}

else if(val=='User_exist'){
	obj['txtKeyWord'].style.display='none';
	obj['cmbexisting'].style.display='';
	
    tamp=checkCmbName('cmbCountryID');
	if(tamp==true){
	obj['cmbCountryID'].style.display='none';
	}
	tamp=checkCmbName('cmbDeliveryID');
	if(tamp==true){
	obj['cmbDeliveryID'].style.display='none';
	}
	tamp=checkCmbName('cmbServicesID');
	if(tamp==true){
	obj['cmbServicesID'].style.display='none';
	}
	tamp=checkCmbName('cmbSubject');
	if(tamp==true){
	obj['cmbSubject'].style.display='none';
	}
}
else if(val=='sub_type'){
	obj['txtKeyWord'].style.display='none';
	obj['cmbSubscribe'].style.display='';
	
    tamp=checkCmbName('cmbCountryID');
	if(tamp==true){
	obj['cmbCountryID'].style.display='none';
	}
	tamp=checkCmbName('cmbDeliveryID');
	if(tamp==true){
	obj['cmbDeliveryID'].style.display='none';
	}
	tamp=checkCmbName('cmbServicesID');
	if(tamp==true){
	obj['cmbServicesID'].style.display='none';
	}
	tamp=checkCmbName('cmbSubject');
	if(tamp==true){
	obj['cmbSubject'].style.display='none';
	}
	tamp=checkCmbName('txtKeyWord1');
	if(tamp==true){
	obj['txtKeyWord1'].style.display='none';
	}
}

//////  Else If For Status for Search section When User select Status other combo 
//////  and search text box as per conditions will be hide

else if(val=='Status'){
	obj['txtKeyWord'].style.display='none';
	obj['txtKeyWord1'].style.display='';
	
    tamp=checkCmbName('cmbCountryID');
	if(tamp==true){
	obj['cmbCountryID'].style.display='none';
	}
	tamp=checkCmbName('cmbDeliveryID');
	if(tamp==true){
	obj['cmbDeliveryID'].style.display='none';
	}
	tamp=checkCmbName('cmbServicesID');
	if(tamp==true){
	obj['cmbServicesID'].style.display='none';
	}
	tamp=checkCmbName('cmbSubscribe');
	if(tamp==true){
	obj['cmbSubscribe'].style.display='none';
	}
}
//////  Else If For Country Id for Search section When User select country All other combo 
//////  and search text box as per conditions will be hide
else if(val=='CountryID'){
	obj['txtKeyWord'].style.display='none';
	obj['cmbCountryID'].style.display='';
	
	tamp=checkCmbName('txtKeyWord1');
	if(tamp==true){
	obj['txtKeyWord1'].style.display='none';
	}
	tamp=checkCmbName('cmbDeliveryID');
	if(tamp==true){
	obj['cmbDeliveryID'].style.display='none';
	}
	tamp=checkCmbName('cmbServicesID');
	if(tamp==true){
	obj['cmbServicesID'].style.display='none';
	}
	
}

//////  Else If For Services ID for Search section When User select Services name All other combo 
//////  and search text box as per conditions will be hide
else if(val=='ServicesID'){

	obj['txtKeyWord'].style.display='none';
	obj['cmbServicesID'].style.display='';
	
	tamp=checkCmbName('txtKeyWord1');
	if(tamp==true){
	obj['txtKeyWord1'].style.display='none';
	}
	tamp=checkCmbName('cmbCountryID');
	if(tamp==true){
	obj['cmbCountryID'].style.display='none';
	}
	tamp=checkCmbName('cmbDeliveryID');
	if(tamp==true){
	obj['cmbDeliveryID'].style.display='none';
	}
	tamp=checkCmbName('cmbexisting');
	if(tamp==true){
	obj['cmbexisting'].style.display='none';
	}
	tamp=checkCmbName('cmbSubject');
	if(tamp==true){
	obj['cmbSubject'].style.display='none';
	}
}

//////  Else If For State Id for Search section When User select State All other combo 
//////  and search text box as per conditions will be hide
else if(val=='DeliveryID'){

	obj['txtKeyWord'].style.display='none';
	obj['cmbDeliveryID'].style.display='';
	
	tamp=checkCmbName('txtKeyWord1');
	if(tamp==true){
	obj['txtKeyWord1'].style.display='none';
	}
	tamp=checkCmbName('cmbCountryID');
	if(tamp==true){
	obj['cmbCountryID'].style.display='none';
	}
	tamp=checkCmbName('cmbServicesID');
	if(tamp==true){
	obj['cmbServicesID'].style.display='none';
	}
}

//////  Else If For Text box for Search section When User select the search id out of combo the other combo 
/////   as per conditions will be hide.
else {
	obj['txtKeyWord'].style.display='';
    tamp=checkCmbName('txtKeyWord1');
	
	if(tamp==true){
	obj['txtKeyWord1'].style.display='none';
	}	
	tamp=checkCmbName('cmbCountryID');
	if(tamp==true){
	obj['cmbCountryID'].style.display='none';
	}
	tamp=checkCmbName('cmbServicesID');
	if(tamp==true){
	obj['cmbServicesID'].style.display='none';
	}
	tamp=checkCmbName('cmbDeliveryID');
	if(tamp==true){
	obj['cmbDeliveryID'].style.display='none';
	}
	tamp=checkCmbName('cmbexisting');
	if(tamp==true){
	obj['cmbexisting'].style.display='none';
	}
	tamp=checkCmbName('cmbSubject');
	if(tamp==true){
	obj['cmbSubject'].style.display='none';
	}
	tamp=checkCmbName('cmbSubscribe');
	if(tamp==true){
	obj['cmbSubscribe'].style.display='none';
	}
}

//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
/*  if(val=="Status"){
    document.frmlist.txtKeyWord.value="";
    obj=document.all['status'];
    obj.style.display='';
    obj=document.all['keyword'];
    obj.style.display='none';
    obj=document.all['country'];
    obj.style.display='none';
	obj=document.all['state'];
    obj.style.display='none';
  }else if (val=="CountryID" ){
    document.frmlist.txtKeyWord.value="";
    obj=document.all['status'];
    obj.style.display='none';
    obj=document.all['keyword'];
    obj.style.display='none';
    obj=document.all['country'];
    obj.style.display='';
	obj=document.all['state'];
    obj.style.display='none';
  }else if (val=="StateID" ){
    document.frmlist.txtKeyWord.value="";
    obj=document.all['status'];
    obj.style.display='none';
    obj=document.all['keyword'];
    obj.style.display='none';
	obj=document.all['country'];
    obj.style.display='none';
    obj=document.all['state'];
    obj.style.display='';
  }
  else{
    obj=document.all['keyword'];
    obj.style.display='';
    obj=document.all['status'];
    obj.style.display='none';
    obj=document.all['country'];
    obj.style.display='none';
	obj=document.all['state'];
    obj.style.display='none';


  }
  */
}








var xmlHttp
function showUser(str)
{ 

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="ajax_get_property.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 //document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
	alert(xmlHttp.responseText);
 } 
}function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}


function search_value(form_name,filename,c)
	{
	var form_obj=form_name;

	
	if(form_obj.txtKeyWord.value=="")
		{

		alert("please Enter Search Keyword");
		return false;
		}
	else
		{

		key_val=form_obj.txtKeyWord.value;
		field=form_obj.cmbSearch.value;
		x=filename+c+"&method=search&keyword="+key_val+"&field="+field;
		window.location=x;
		return false;
		}
	
	}

function checkDelete_new()
{
	var y=0; var ans;
	y = getCheckCount_new();

	if(y>0)
	{	ans = confirm("Confirm Deletion of Selected Record(s) ?");
		if(ans == true)
		{	
		document.frmlist1.method.value="DeleteAll";
		document.frmlist1.submit();
		}
		else
		{return false;}
	}
	else
	{	alert("Please Select a Record(s) to Delete.");	return false;	}
}

function checkAll_new()
{

	var rs = (document.frmlist1.abc.checked)?true:false;

	for(i=0;i<document.frmlist1.elements.length;i++)
	{
	  	if(document.frmlist1.elements[i].id == 'iId')
  		{
			document.frmlist1.elements[i].checked = rs;
		}

	}
}
function getCheckCount_new()
{	var x=0;

	for(i=0;i < document.frmlist1.elements.length;i++)
	{	if (document.frmlist1.elements[i].id == 'iId' && document.frmlist1.elements[i].checked == true)
			{x++;}
	}
	return x;
}


