 var state = new Array(4);
	 var capital = new Array(4);
	 state[0] = "--Select State--";
 	 state[1] = "Haryana";
	 state[2] = "U.P";	 
	 state[3] = "Uttarakhand";	
	 
	 capital[0]= "Select State";
	 capital[1]= "---Select City---,Gurgaon,Panipat,Sonipat";	 
	 capital[2]= "---Select City---,Meerut,Lucknow,Banaras";	 
	 capital[3]= "---Select City---,Haridwar,Dehradun,Rishikesh";	 	 
	 var city=new Array(10);
	 city[0]="---Select City---";
	city[1]="Delhi";
	city[2]="Mumbai";
	city[3]="Kolkata";
	city[4]="Ludhiana";
function FillState()
 {alert("in");
	
	 var w;
	 for(i=0;i<=3;i++)
	 {
	
		document.frmaddStore.selState.options[i]=new Option(state[i],i);
	 }
	 //document.frmaddStore
	 }
function Fillcitynew()
 {
		 var i;
	 for(i=0;i<=4;i++)
	 {
			document.frmaddStore.selCity.options[i]=new Option(city[i],i);
	 }
	 }
	 	 
	 
function populatecity ()
{
	Fillcitynew();
	//alert(document.frmaddStore.HCityID.value);
	 for(i=0;i<=document.frmaddStore.selCity.options.length;i++)
	 {
		if(document.frmaddStore.HCityID.value == i)
		document.frmaddStore.selCity.selectedIndex = i;
	 }
	
	
	
	}
function populateState()
 {   FillState();


	 var i;
	 for(i=0;i<=document.frmaddStore.selState.options.length;i++)
	 {alert("in")
		if(document.frmaddStore.HStateID.value == i)
		document.frmaddStore.selState.selectedIndex = i;
	 }
	 
	 GetCity(document.frmaddStore.selState.selectedIndex);
	 
	// alert('hh=' + document.frmaddStore.HCityID.value);
	 
	  var j;
	 for(j=0;j<=document.frmaddStore.selCity.options.length;j++)
	 {
		if(j == document.frmaddStore.HCityID.value)
		{document.frmaddStore.selCity.selectedIndex = j;}
	 }
 }

function GetCity(StateID)
 {
	
   arrCity  = capital[StateID].split(",");

   var j=0;
   for(j=0;j<arrCity.length;j++)
    {
		document.frmaddStore.selCity.options[j]=new Option(arrCity[j],j);
	 } // end For
 }
 
 function ComboValid(frm)
 { //var isSelect = frm.selState.value;
//    if(isSelect==0)
//	{
//		alert("Please select State");
//		frm.selState.focus();
//		return false;
//		}
	var isSelect = frm.selCity.value;
	
	if(isSelect==0)
	{
		alert("Please select City");
		frm.selCity.focus();
		return false;
		}
		
	if(frm.txtAdd.value.length > 200)
	{  
	  alert("Address can not be more then 200 character");
	  frm.txtAdd.select();
	  return false;
		}
	
	var v1 = LimitAttach(frm,frm.fileThumb.value);
	if(v1==false)
	{
		 frm.fileThumb.focus();
		 return false;
		}
		
	var v1 = LimitAttach(frm,frm.fileLarge.value);
	if(v1==false)
	{ 	 frm.fileLarge.focus();
		 return false;
		}
		
	frm.HCityName.value = frm.selCity.options[frm.selCity.selectedIndex].text;
	
	//frm.HStateName.value = frm.selState.options[frm.selState.selectedIndex].text;

 return true;
	 }

//Start : Check Extension for the uploaded file //
 extArray = new Array(".gif", ".jpg");
function LimitAttach(form, file) {
allowSubmit = false;
if (!file) return;
while (file.indexOf("\\") != -1)
file = file.slice(file.indexOf("\\") + 1);
ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext) { allowSubmit = true; break; }
}
if (allowSubmit)
{return true;}
else
{
alert("Please only upload files that end in types:  " 
+ (extArray.join("  ")) + "\nPlease select a new "
+ "file to upload and submit again.");
return false;
}
}

// End : check Extension for the uploaded file //

// Start ::Pagin //
/*
function changePage(intpg,fld,ordr)
{  document.paging.page.value = intpg;
   document.paging.SortField.value = fld;
   document.paging.order.value = ordr;
   document.paging.submit();
	alert("Paging = " + document.paging.page.value);
	}

function nextPage()
 {
	 vat intpg = document.paging.page.value; 
	 intpg++;
	 document.paging.page.value = intpg;
}
	*/
// End ::Pagin //

// Start :: FCK EDITOR  //
function validateFCK()
{  
    var isValid;
    var oEditor ;
	if(typeof( FCKeditorAPI ) != 'undefined')
	  {
	   oEditor = FCKeditorAPI.GetInstance('page_contents');
	    var event_detail = oEditor.GetHTML();
	   } 

	 
	 if(event_detail.length == 0) 
	 { 
	    alert("Please Enter Description !!");
	    oEditor.Focus();
	   //document.frmNews.page_content.focus();
		return false;
	  }
	  else
	  {
		if(event_detail.length >  2000)
	    { 
	    	alert("You Can Not Enter More Then 2000 Charecter !!");
			oEditor.Focus();
	     	return false;
	     }
	  }

	return true;
} // end validateFCK



function resetEditors() 
{ 
    // If the editor API does not exist, there are no editors 
    if (typeof FCKeditorAPI == "undefined") return; 

    // Loop through all FCK instances, in case there are several editors 
    for (var sEditorName in FCKeditorAPI.__Instances) 
    { 
        // The initial value that was set when the form was created 
        // is stored in a hidden <INPUT> with the same name as the 
        // editor (the editor itself is in an <IFRAME> with ___Frame 
        // appended to the name.  Check whether that INPUT exists 
        if (document.getElementById(sEditorName)) 
        { 
            // Get the initial value 
            var sInitialValue = document.getElementById(sEditorName).value; 
            // Overwrite the editor's current value 
			sInitialValue="";
            FCKeditorAPI.__Instances[sEditorName].SetHTML(sInitialValue); 
        } // end if 
    } // end for
} // end reset

// End :: FCK EDITOR //