var em  = new Array();
var st = new Array();
em[1] = "1,2,3,4,5,6,7,8,9,10,11,12,13,148";em[2] = "146,148";em[3] = "14,148";em[4] = "15,16,148";em[5] = "17,18,148";em[6] = "19,148";em[7] = "20,21,148";em[8] = "22,148";em[9] = "23,148";em[10] = "24,148";em[11] = "25,26,27,28,148";em[12] = "29,30,31,32,33,34,35,36,37,38,39,40,41,42,148";em[13] = "43,44,45,46,47,48,49,148";em[14] = "50,51,52,53,148";em[15] = "54,55,148";em[16] = "56,57,58,59,148";em[17] = "60,61,62,63,64,65,66,67,68,69,148";em[18] = "70,71,72,73,74,75,76,77,78,79,80,148";em[19] = "147,148";em[20] = "81,82,83,84,85,148";em[21] = "86,87,88,89,90,91,92,93,94,148";em[22] = "95,148";em[23] = "96,148";em[24] = "97,148";em[25] = "98,148";em[26] = "99,100,101,102,103,148";em[27] = "104,148";em[28] = "105,106,107,108,109,110,148";em[29] = "111,112,113,114,115,116,148";em[30] = "117,148";em[31] = "118,119,120,121,122,123,124,125,126,127,148";em[32] = "128,148";em[33] = "129,130,131,132,133,134,135,136,137,138,139,140,141,148";em[34] = "142,148";em[35] = "143,144,145,148";em[36] = "148";
st[1] = "Anantapur";
st[2] = "Guntakal";
st[3] = "Guntur";
st[4] = "Hyderabad";
st[5] = "Kurnool";
st[6] = "Nellore"; 
st[7] = "Nizamabad";
st[8] = "Rajahmundry";
st[9] = "Secunderabad";
st[10] = "Tirupati";
st[11] = "Vijayawada";
st[12] = "Visakhapatnam";
st[13] = "Warangal";



st[14] = "Itanagar";



st[15] = "Guwahati";
st[16] = "Silchar";



st[17] = "Bahgalpur";
st[18] = "Patna";



st[19] = "Chandigarh";

st[20] = "Bhillai";
st[21] = "Raipur";


st[22] = "Dadra&Nagar Haveli";

st[23] = "Daman&Dui";

st[24] = "Delhi/NCR";

st[25] = "Goa";
st[26] = "Panaji";
st[27] = "Panjim";
st[28] = "Vasco Da Gama";



st[29] = "Ahmedabad";
st[30] = "Anand";
st[31] = "Baroda";
st[32] = "Bharuch";
st[33] = "Bhavnagar";
st[34] = "Bhuj";
st[35] = "Gandhinagar";
st[36] = "Gir";
st[37] = "Jamnagar";
st[38] = "Kandla";
st[39] = "Porbandar";
st[40] = "Rajkot";
st[41] = "Surat";
st[42] = "Vadodara";


st[43] = "Ambala";
st[44] = "Faridabad";
st[45] = "Gurgaon";
st[46] = "Karnal";
st[47] = "Kurukshetra";
st[48] = "Panipat";
st[49] = "Rohtak";


st[50] = "Dalhousie";
st[51] = "Dharmsala";
st[52] = "Kulu/Manali";
st[53] = "Shimla";



st[54] = "Jammu";
st[55] = "Srinagar";



st[56] = "Bokaro";
st[57] = "Dhanbad";
st[58] = "Jamshedpur";
st[59] = "Ranchi";



st[60] = "Bangalore";
st[61] = "Belgaum";
st[62] = "Bellary";
st[63] = "Bidar";
st[64] = "Dharwad";
st[65] = "Gulbarga";
st[66] = "Hubli";
st[67] = "Kolar";
st[68] = "Mangalore";
st[69] = "Mysore";




st[70] = "Calicut";
st[71] = "Cochin";
st[72] = "Ernakulam";
st[73] = "Kochi";
st[74] = "Kollam";
st[75] = "Kottayam";
st[76] = "Kozhikode";
st[77] = "Palakkad";
st[78] = "Palghat";
st[79] = "Thrissur";
st[80] = "Trivandrum";




st[81] = "Bhopal";
st[82] = "Gwalior";
st[83] = "Indore";
st[84] = "Jabalpur";
st[85] = "Ujjain";




st[86] = "Ahmednagar";
st[87] = "Aurangabad";
st[88] = "Jalgaon";
st[89] = "Kolhapur";
st[90] = "Mumbai";
st[91] = "Nagpur";
st[92] = "Nasik";
st[93] = "Pune";
st[94] = "Sholapur";


st[95] = "Imphal";



st[96] = "Shillong";



st[97] = "Aizawal";



st[98] = "Dimapur";



st[99] = "Bhubaneshwar";
st[100] = "Cuttack";
st[101] = "Paradeep";
st[102] = "Puri";
st[103] = "Rourkela";



st[104] = "Pondicherry";


st[105] = "Amritsar";
st[106] = "Jalandhar";
st[107] = "Ludhiana";
st[108] = "Mohali";
st[109] = "Pathankot";
st[110] = "Patiala";



st[111] = "Ajmer";
st[112] = "Jaipur";
st[113] = "Jaisalmer";
st[114] = "Jodhpur";
st[115] = "Kota";
st[116] = "Udaipur";



st[117] = "Gangtok";



st[118] = "Chennai";
st[119] = "Coimbatore";
st[120] = "Erode";
st[121] = "Hosur";
st[122] = "Madurai";
st[123] = "Ooty";
st[124] = "Salem";
st[125] = "Tirunelveli";
st[126] = "Trichy";
st[127] = "Vellore";



st[128] = "Agartala";



st[129] = "Agra";
st[130] = "Aligarh";
st[131] = "Allahabad";
st[132] = "Bareilly";
st[133] = "Faizabad";
st[134] = "Ghaziabad";
st[135] = "Gorakhpur";
st[136] = "Kanpur";
st[137] = "Lucknow";
st[138] = "Mathura";
st[139] = "Meerut";
st[140] = "Noida";
st[141] = "Varanasi";



st[142] = "Dehradun";


st[143] = "Durgapur";
st[144] = "Kharagpur";
st[145] = "Kolkata";

st[146] = "Andaman&Nicobar Island";
st[147] = "Lakshadweep Islands";
st[148] = "Other";


function showHideCityOpenBox()
{
//        cityDD = document.getElementById(cityId);
		//alert("cityDD");

 /*       var selI = cityDD.selectedIndex;
        if (cityDD[selI].value.match("Other") != null) // selected element contains "other", so show "ocity open box"
	{
                changeObjectVisibility(ocityId, '');
		alert("here");
	}
        else
	{
                changeObjectVisibility(ocityId, 'none');
	}
*/
}
function a()
{
//alert("sd");
}

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
        // W3C DOM
        return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
        // MSIE 4 DOM
        return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
        // NN 4 DOM.. note: this won't find nested layers
        return document.layers[objectId];
    } else {
        return false;
    }
}
function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists

    var styleObject = getStyleObject(objectId);
    if(styleObject) {
        styleObject.display= newVisibility;
        return true;
    } else {
        // we couldn't find the object, so we can't change its visibility
        return false;
    }
}

function showHideCityOpenBox(cityId, ocityId)
{

cityDD = document.getElementById(cityId);

        var selI = cityDD.selectedIndex;
        if (cityDD[selI].value.match("36") != null) {//alert("3")// selected element contains "other", so show "ocity open box"
                changeObjectVisibility(ocityId, '');}
        else{//alert("4")
                changeObjectVisibility(ocityId, 'none');}

}

function showHideCityOnlyBox(stateId, ostateId)
{
//alert("IN")
cityDD = document.getElementById(stateId);

        var selI = cityDD.selectedIndex;
        if (cityDD[selI].value.match("Other") != null) {//alert("3")// selected element contains "other", so show "ocity open box"
                changeObjectVisibility(ostateId, '');}
        else{//alert("4")
                changeObjectVisibility(ostateId, 'none');}

}
function showHideQualOnlyBox(qualId, oqualId)
{
//alert("IN")
cityDD = document.getElementById(qualId);

        var selI = cityDD.selectedIndex;
        if (cityDD[selI].value.match("Other") != null) {//alert("3")// selected element contains "other", so show "ocity open box"
                changeObjectVisibility(oqualId, '');}
        else{//alert("4")
                changeObjectVisibility(oqualId, 'none');}

}
function showHideCityOtherBox(cityId, ocityId)
{

cityDD = document.getElementById(cityId);
		/*alert(cityDD)
	    var citylen = cityDD.length
		var curcity = citylen - 1
		alert(curcity)*/
        var selI = cityDD.selectedIndex;
		var selInd = cityDD.selectedIndex;
		//alert(selI)
		var state=document.feedbackfrm.state.value
		//alert(state)
		if(state==1){
			selI=14
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{//alert("4")
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==2){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==3){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==4){
			selI=3
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==5){
			selI=3
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==6){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==7){
			selI=3
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==8){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==9){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==10){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==11){
			selI=5
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==12){
			selI=15
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==13){
			selI=8
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==14){
			selI=5
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==15){
			selI=3
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==16){
			selI=5
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==17){
			selI=11
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==18){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==19){
			selI=12
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==20){
			selI=6
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==21){
			selI=10
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==22){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==23){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==24){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==25){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==26){
			selI=6
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==27){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==28){
			selI=7
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==29){
			selI=7
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==30){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==31){
			selI=11
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==32){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==33){
			selI=14
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==34){
			selI=2
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==35){
			selI=4
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
		else if(state==36){
			selI=1
				if(selInd == selI){
					changeObjectVisibility(ocityId, '');}
				        else{
                changeObjectVisibility(ocityId, 'none');}
		}
//alert(cityDD[selI].value)
//alert(selI)
//		var checkCity = cityDD[selI].value
//alert(checkCity)
	//alert(curcity)
	//alert(selI)
        /*if (curcity == selI) {alert("3")// selected element contains "other", so show "ocity open box"
                changeObjectVisibility(ocityId, '');}
        else{alert("4")
                changeObjectVisibility(ocityId, 'none');}*/

}
function showHideOtherOpenBox(callingDDId, openBoxId, otherString)
{
		//alert("5")
        otherString = (otherString == null) ? 'Other' : otherString;

        var callingDD = document.getElementById(callingDDId);
        var selI = callingDD.selectedIndex;
        if (callingDD[selI].value == otherString)
                changeObjectVisibility(openBoxId, '');
        else
                changeObjectVisibility(openBoxId, 'none');
}
function cityChangedEvent(cityVal,form_country_id,form_ocountry_id)
{
//	alert("1")
        if (cityVal != 'Other')
        {
                var cntryEle = document.getElementById(form_country_id);
//alert("6")
                for (i = 0; i < cntryEle.length; ++i)
                {
                        if (cntryEle[i].value == "INDIA")
                        {
                                cntryEle.selectedIndex = i;
                                showHideOtherOpenBox(form_country_id,form_ocountry_id);
                                break;
                        }
                }
        }
}
function cntryChangedEvent(cntryVal, form_city_id, form_ocity_id)
{
        var cityEle = document.getElementById(form_city_id);

        if (cntryVal == "select")
        {
                cityEle.selectedIndex = 0;
                showHideCityOpenBox(form_city_id, form_ocity_id);
        }
        else if (cntryVal != 'INDIA')
        {
                cityEle.selectedIndex = cityEle.length - 1;
                showHideCityOpenBox(form_city_id, form_ocity_id);
        }
        else if (cntryVal == 'INDIA')
        {
                cityEle.selectedIndex = 0;
                showHideCityOpenBox(form_city_id, form_ocity_id);
        }
}
function hideMBA()
{
        var ppgcourse=document.getElementById('pgcourse_id');
        var mbatype=document.getElementById('mbatype_id');
        var sp1 = ppgcourse.value.split("|X|");

        if(sp1[0]=='MBA/PGDM')
        {
                mbatype.style.display="";
        }
        else
        {
                mbatype.style.display="none";
        }
}

function hideElements_ackpage()
{
        var ppg_course = document.getElementById('ppgcourse_id');
        var oppg_course = document.getElementById('oppgcourse_id');
        if(ppg_course.value!='Other')
                oppg_course.style.display="none";
}
function hideElements()
{
        var country= document.getElementById('country_id');
        var oCountry=document.getElementById('ocountry_id');
        var currLocation=document.getElementById('city_id');
        var oCurrLocation=document.getElementById('ocity_id');
        var stateLocation=document.getElementById('state_id');
        var oStateLocation=document.getElementById('ostate_id');
        var qualLocation=document.getElementById('qual_id');
        var oQualLocation=document.getElementById('oqual_id');

        if(country.value!='Other')
                oCountry.style.display="none";
        if(!currLocation.value.match('Other'))
                oCurrLocation.style.display="none";
        if(!stateLocation.value.match('Other'))
                oStateLocation.style.display="none";
        if(!qualLocation.value.match('Other'))
                oQualLocation.style.display="none";
}
function hideElementsEapps1()
{
        var country= document.getElementById('country_id');
        var oCountry=document.getElementById('ocountry_id');
        var currLocation=document.getElementById('city_id');
        var oCurrLocation=document.getElementById('ocity_id');
        var ug_course = document.getElementById('ugcourse_id');
        var oug_course = document.getElementById('ougcourse_id');
        var pg_course = document.getElementById('pgcourse_id');
        var opg_course = document.getElementById('opgcourse_id');


        if(country.value!='Other')
                oCountry.style.display="none";
        if(!currLocation.value.match('Other'))
                oCurrLocation.style.display="none";

        if(ug_course.value!='Other')
                oug_course.style.display="none";
        if(pg_course.value!='Other')
                opg_course.style.display="none";
}
function hideElementsEapps2(pgcourse)
{
        var ug_spec = document.getElementById('ugspec_id');
        var oug_spec = document.getElementById('ougspec_id');
        if(ug_spec.value!='Other')
                oug_spec.style.display="none";
	try
	{
	        var pg_spec = document.getElementById('pgspec_id');
        	var opg_spec = document.getElementById('opgspec_id');

	        if(pg_spec.value!='Other')
        	        opg_spec.style.display="none";
	}
	catch(e){}
}
function hideMBA()
{
        if(document.getElementById('pgcourse_id'))
        {
                var ppgcourse=document.getElementById('pgcourse_id');
                var mbatype=document.getElementById('mbatype_id');
        //        var cell=document.getElementById('pgcolumn_id');
                var sp1 = ppgcourse.value.split("|X|");

                if(sp1[0]=='MBA/PGDM')
                {
                        mbatype.style.display="";
          //              cell.style.display="none";
                }
                else
                {
                        mbatype.style.display="none";
          //              cell.style.display="";
                }
        }
}

function checkSelectionLimit(formEle, limit)
{
        var returnVal = true;

        var count = 0;
        for (var i = 0; i < formEle.length; ++ i)
        {
                if (formEle[i].selected)
                {
                        ++count;

                        if (count > limit)
                        {
                                alert("You cannot select more than " + limit + " options!");
                                returnVal = false;

                                formEle[i].selected = false;
                        }
                }
        }

        return returnVal;
}

function rm_setCountryAreaCode(cntryDDId, currLocnDDId, cntryCodeBoxId, areaCodeBoxId)
{

        countryCode = new Array();
        cityCode = new Array();

/* ****************             STD CODES FOR CITIES OF INDIA           **************** */


        cityCode['Ahmedabad'] = "79";
        cityCode['Bangalore'] = "80";
        cityCode['Chennai'] = "44";
        cityCode['Delhi'] = "11";
        cityCode['Hyderabad'] = "40";
        cityCode['Kolkata'] = "33";
        cityCode['Mumbai'] = "22";
        cityCode['Pune'] = "20";

/* ****************             ISD CODES               **************** */

        countryCode["INDIA"] = "91";
//      countryCode["Other"] = "";

/* ************************************************ */

        var cntryDD = document.getElementById(cntryDDId);
        var currLocnDD = document.getElementById(currLocnDDId);

        var cntryCodeBox = document.getElementById(cntryCodeBoxId);
        var areaCodeBox = document.getElementById(areaCodeBoxId);

        var selectedCountry =  cntryDD.options[cntryDD.options.selectedIndex].value;
        var selectedCity = currLocnDD.options[currLocnDD.options.selectedIndex].value;
        if(countryCode[selectedCountry]==null)
		{
                if(trim(cntryCodeBox.value)=="91")
                        cntryCodeBox.value = "";
        }
        else
                cntryCodeBox.value = countryCode[selectedCountry];

        if(cityCode[selectedCity]==null)
        {
                areaCodeBox.value = "";
        }
        else if (cityCode[selectedCity]!=null)
                areaCodeBox.value = cityCode[selectedCity];


        if(selectedCountry!="INDIA")
        {
                currLocnDD.value = "Other";
        }
        else;

}
function populateStream(doc,any,degreeObj,streamObj,selectStream) 
{
	var streamOptLen = streamObj.options.length;
	var i = 0;
	for(var len=0;len<streamOptLen;len++) 
	{
		streamObj.options[len].selected = false;
	}
	streamObj.options.length = 0;
	for(var i=0; i< degreeObj.options.length; i++) 
	{
		var lval = degreeObj.options[i].value;
		//alert(lval)
		if(degreeObj.options[i].selected && lval.length > 0) 
		{
			var str  = em[lval];
			var map  = str.split(',');
			if(map.length >0)
			{
				var opt = new Option();
				opt.value="Select";
				opt.text='--Select--';
				opt.selected=true;
				streamObj.options[streamObj.options.length] = opt;
			}
			for(var mapi=0; mapi < map.length; mapi++) 
			{
				var opt = new Option();
				opt.value=map[mapi];
				if((opt.value == 47) && (any == 'NO')  && (lval != 7) && (lval != 8) && (lval != 10))
				     continue;
				opt.text=st[map[mapi]];
				if ( selectStream == map[mapi] )
				{
					opt.selected = true;
				}
				streamObj.options[streamObj.options.length] = opt;
			}
		}
	}
}
function trim(inputString) {
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") {
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") {
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) {
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length);
   }
   return retValue;
}
function checkNumber(field){
			var valid = "0123456789"
			var ok = "yes";
			var temp;
			for (var i=0; i<field.value.length; i++){
				temp = "" + field.value.substring(i, i+1);
				if (valid.indexOf(temp) == "-1") ok = "no";
			}
			if (ok == "no") {
				alert("Pin code should be a Numerical value");
				field.focus();
				field.select();
				return false;
			 }
			 return true;
		}
function checkmail(){
		var error_msg="";
		var error_flag=true;

		var email1 = trim(document.thanksfrm.email1.value);
		var email2 = trim(document.thanksfrm.email2.value);
		var email3 = trim(document.thanksfrm.email3.value);
		var email4 = trim(document.thanksfrm.email4.value);
		var email5 = trim(document.thanksfrm.email5.value);


if(email1 !="" && email1.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
		{
			error_msg="Please enter a valid Email ID";
			document.thanksfrm.email1.focus();
			document.thanksfrm.email1.select();
			error_flag=false;
		}
else if(email2 !="" && email2.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
		{
			error_msg="Please enter a valid Email ID";
			document.thanksfrm.email2.focus();
			document.thanksfrm.email2.select();
			error_flag=false;
		}
else if(email3 !="" && email3.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
		{
			error_msg="Please enter a valid Email ID";
			document.thanksfrm.email3.focus();
			document.thanksfrm.email3.select();
			error_flag=false;
		}
else if(email4 !="" && email4.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
		{
			error_msg="Please enter a valid Email ID";
			document.thanksfrm.email4.focus();
			document.thanksfrm.email4.select();
			error_flag=false;
		}
else if(email5 !="" && email5.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
		{
			error_msg="Please enter a valid Email ID";
			document.thanksfrm.email5.focus();
			document.thanksfrm.email5.select();
			error_flag=false;
		}
else if(email1 =="" && email2 =="" && email3 =="" && email4 =="" && email5 =="")
		{
			error_msg="Please enter email id to send";
			document.thanksfrm.email1.focus();
			document.thanksfrm.email1.select();
			error_flag=false;
		}

		if(error_flag)
			return true;
		else
		{
			alert(error_msg);
			return false;
		}
}

function validate()
{
		var e = document.feedbackfrm;
		var title=trim(e.title.value);
		var name=trim(e.name.value);
		var cname=trim(e.cname.value);
		var gender=trim(e.gender.value);
		var age=trim(e.Age.value);
		var qual=trim(e.Qual.value);
		var txtqual=trim(e.txtqual.value);
		var txtCc=trim(e.txtCc.value);
		var txtSc=trim(e.txtSc.value);
		var txtPhNo=trim(e.txtPhNo.value);
		var txtMobCc=trim(e.txtMobCc.value);
		var txtMobNo=trim(e.txtMobNo.value);
		var stremail=trim(e.email.value);
		var strsubj=trim(e.subject.value);
		var country=trim(e.country.value);
		var txtcountry=trim(e.ocountry.value);
		var state=trim(e.state.value);
		var txtstate=trim(e.ocity.value);
		var city=trim(e.city.value);
		var txtcity=trim(e.ostate.value);
		var strhow=trim(e.How.value);
		var strmessage=trim(e.Message.value);

		var error_msg="";
		var error_flag=true;
		
		if(title=="Select")
		{
			error_msg="Please select your title.";
			document.feedbackfrm.title.focus();
			error_flag=false;
		}
		else if (name == "")
		{
			error_msg="Please enter your full name";
			document.feedbackfrm.name.focus();
			document.feedbackfrm.name.select();
			error_flag=false;
		}
 		else if(name.search(/[^a-zA-Z\.\s\']/) != -1)
		{
	error_msg="Numeric values & special charecters are not allowed in the 'Name' field (except . and ' )";
			document.feedbackfrm.name.focus();
			document.feedbackfrm.name.select();
			error_flag=false;
		}
		else if(gender=="Select")
		{
			error_msg="Please select your gender.";
			document.feedbackfrm.gender.focus();
			error_flag=false;
		}
		else if(age=="Select")
		{
			error_msg="Please select your age group.";
			document.feedbackfrm.Age.focus();
			error_flag=false;
		}
		else if(qual=="Select")
		{
			error_msg="Please select your Qualification.";
			document.feedbackfrm.Qual.focus();
			error_flag=false;
		}
		else if(qual=="Other" && txtqual=="Other" || txtqual==""){
				error_msg+="Since you have chosen 'Other' from Qualification dropdown, please specify your Qualification in the text box provided.";
				document.feedbackfrm.txtqual.focus();
				document.feedbackfrm.txtqual.select();
				error_flag=false;
			}
		else if(txtqual.search(/[^1234567890]/) == -1){
					error_msg+="Numeric Values are not allowed in the 'Qualfication' field.";
					document.feedbackfrm.txtqual.focus();
					document.feedbackfrm.txtqual.select();
					error_flag=false;
			}

		else if(txtPhNo == "" && txtMobNo == ""){
					error_msg="Please enter either Phone number or Mobile number.";
					document.feedbackfrm.txtPhNo.focus();
					document.feedbackfrm.txtPhNo.select();
					error_flag=false;
		}
		else if(txtCc == "" && txtPhNo != ""){
					error_msg="Please enter the Country Code.";
					document.feedbackfrm.txtCc.focus();
					document.feedbackfrm.txtCc.select();
					error_flag=false;
		}
		else if(txtCc.search(/[^1234567890]/) != -1){
					error_msg="Alphabets & special characters are not allowed in the 'Country Code' field.";
					document.feedbackfrm.txtCc.focus();
					document.feedbackfrm.txtCc.select();
					error_flag=false;
				}	
		else if(txtSc == "" && txtPhNo != ""){
					//alert("hi");
					error_msg="Please enter the State Code.";
					document.feedbackfrm.txtSc.focus();
					document.feedbackfrm.txtSc.select();
					error_flag=false;
		}
		else if(txtSc.search(/[^1234567890]/) != -1){
					error_msg="Alphabets & special characters are not allowed in the 'State Code' field.";
					document.feedbackfrm.txtSc.focus();
					document.feedbackfrm.txtSc.select();
					error_flag=false;
				}	
		else if(txtPhNo.search(/[^1234567890]/) != -1){
					error_msg="Alphabets & special characters are not allowed in the 'Phone Number' field.";
					document.feedbackfrm.txtPhNo.focus();
					document.feedbackfrm.txtPhNo.select();
					error_flag=false;
				}
				
		else if(txtMobNo != "" && txtMobNo.search(/[^1234567890]/) != -1){
					error_msg+="Alphabets & special charecters are not allowed in the 'Mobile Number' field.";
					document.feedbackfrm.txtMobNo.focus();
					document.feedbackfrm.txtMobNo.select();
					error_flag=false;
			}
		else if(txtMobCc == "" && txtMobNo != ""){
					error_msg="Please enter the Country Code.";
					document.feedbackfrm.txtMobCc.focus();
					document.feedbackfrm.txtMobCc.select();
					error_flag=false;
			}
		else if(txtMobCc != "" && txtMobCc.search(/[^1234567890]/) != -1){
					error_msg+="Alphabets & special charecters are not allowed in the 'Mobile Number' field.";
					document.feedbackfrm.txtMobCc.focus();
					document.feedbackfrm.txtMobCc.select();
					error_flag=false;
			}
		/*	else if(txtMobCc != ""){
				if(txtMobCc.search(/[^1234567890]/) != -1){
					error_msg+="Alphabets & special charecters are not allowed in the 'Country Code' field.\n";
					document.feedbackfrm.txtMobCc.focus();
					error_flag=false;
				}	
			}
			else if(txtMobNo != ""){
				if(txtMobNo.search(/[^1234567890]/) != -1){
					error_msg+="Alphabets & special charecters are not allowed in the 'Mobile Number' field.\n";
					document.feedbackfrm.txtMobNo.focus();
					error_flag=false;
				}	
			}
		
		}*/

		/*else if(stremail=="")
		{
			error_msg="Please specify your Email ID.\n";
			document.feedbackfrm.email.focus();
			error_flag=false;
		}*/
	else if (stremail !="" && stremail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
		{
			error_msg="Please enter a valid Email ID";
			document.feedbackfrm.email.focus();
			document.feedbackfrm.email.select();
			error_flag=false;
		}

		else if(strsubj=="Select")
		{
			error_msg="Please select your subject.";
			document.feedbackfrm.subject.focus();
			error_flag=false;
		}

		else if(country=="Select")
		{
			error_msg="Please select your country.";
			document.feedbackfrm.country.focus();
			error_flag=false;
		}
		else if(country=="Other" && txtcountry=="Other" || country==""){
				error_msg="Since you have chosen 'Other' from Country dropdown, please specify your Country in the text box provided.";
			document.feedbackfrm.ocountry.focus();
			document.feedbackfrm.ocountry.select();
				error_flag=false;
			}
		else if(txtcountry.search(/[^a-zA-Z\.\s\&\s\,\s\(\s\)]/) != -1)
			{
	error_msg="Numeric values & special charecters are not allowed in the 'Country' field (except .(),&)";
			document.feedbackfrm.ocountry.focus();
			document.feedbackfrm.ocountry.select();
					error_flag=false;
			}
		else if(state=="")
		{
			error_msg="Please select your state.";
			document.feedbackfrm.state.focus();
			error_flag=false;
		}
		else if(state=="36" && txtstate=="Other" || state==""){
		error_msg="Since you have chosen 'Other' from State dropdown, please specify your State in the text box provided.";
			document.feedbackfrm.ocity.focus();
			document.feedbackfrm.ocity.select();
				error_flag=false;
		}
		else if(txtstate.search(/[^a-zA-Z\.\s\&\s\,\s\(\s\)]/) != -1)
			{
		error_msg="Numeric values & special charecters are not allowed in the 'state' field (except .(),&)";
			document.feedbackfrm.ocity.focus();
			document.feedbackfrm.ocity.select();
					error_flag=false;
			}

		else if(city=="Select")
		{
			error_msg="Please select your city.";
			document.feedbackfrm.city.focus();
			error_flag=false;
		}
		else if(city=="148" && txtcity=="Other" || city==""){
				error_msg="Since you have chosen 'Other' from City dropdown, please specify your City in the text box provided.";
			document.feedbackfrm.ostate.focus();
			document.feedbackfrm.ostate.select();
				error_flag=false;
			}
		else if(txtcity.search(/[^a-zA-Z\.\s\&\s\,\s\(\s\)]/) != -1)
			{
	error_msg="Numeric values & special charecters are not allowed in the 'city' field (except .(),&)";
			document.feedbackfrm.ostate.focus();
			document.feedbackfrm.ostate.select();
			error_flag=false;
			}
		else if(strhow=="Select")
		{
			error_msg="Please select 'How did you hear about ChennaiMirror'.";
			document.feedbackfrm.How.focus();
			error_flag=false;
		}
		else if(strmessage=="")
		{
			error_msg="Please enter your message.";
			document.feedbackfrm.Message.focus();
			error_flag=false;
		}
		/*if(e.country.value=="select")
		{
			error_msg+="Please specify your country of residence.\n";
			error_flag=false;
		}
		else if(e.country.value=="Other" &&(trim(e.ocountry.value)=="Other" || trim(e.ocountry.value)==""))
		{
			error_msg+="Since you have chosen 'Other' from Country dropdown, please specify your country in the text box provided.\n";
			error_flag=false;
		}
		if(e.city.value=="select")
		{
			error_msg+="Please specify your city of residence.\n";
			error_flag=false;
		}
		else if(e.city.value.match("Other") &&(trim(e.ocity.value)=="Other" || trim(e.ocity.value)==""))
                {
                        error_msg+="Since you have chosen 'Other' from City dropdown, please specify your city in the text box provided.\n";
                        error_flag=false;
                }

		if(trim(stremail)=="")
		{
			error_msg+="Please specify your Email ID\n";
			error_flag=false;
		}
		else if (stremail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
		{
			error_msg+="Please enter a valid Email ID\n";
			error_flag=false;
		}
		if(e.totalexp_yy.value=="")
		{
			error_msg+="Please specify your experience.\n";
			error_flag=false;
		}
		if((e.attachcv.value=="")&&(e.strAttachedCV.value==""))
		{
		error_msg+="Please ensure that you are uploading a word file (.doc) only and the file is not in use.";
			error_flag=false;
		}*/
		if(error_flag)
			return true;
		else
		{
			alert(error_msg);
			return false;
		}
}


