function hideOElements()
{
        var country= document.getElementById('country_id');
        var oCountry=document.getElementById('ocountry_id');
        var currLocation=document.getElementById('currlocation_id');
        var oCurrLocation=document.getElementById('ocurrlocation_id');
	var ug_course = document.getElementById('ugcourse_id');
        var oug_course = document.getElementById('ougcourse_id');
        var pg_course = document.getElementById('pgcourse_id');
        var ppg_course = document.getElementById('ppgcourse_id');
        var opg_course = document.getElementById('opgcourse_id');
        var oppg_course = document.getElementById('oppgcourse_id');
	var mbatype=document.getElementById('mbatype_id');
    if(country.value!='Other')
        oCountry.style.display="none";
	if(country.value == 'INDIA')
	{
      		if(!currLocation.value.match('Other'))
	       	oCurrLocation.style.display="none";
	}

	if(ug_course.value!='B.A')
	oug_course.style.display="none";

	if(pg_course.value!='Other')
	opg_course.style.display="none";

	if(ppg_course.value!='Other')
	oppg_course.style.display="none";
	mbatype.style.display="none";
	
}


function hideOElements_edit()
{
       if(document.getElementById('edit_resume'))
	{
		var country= document.getElementById('country_id');
		var oCountry=document.getElementById('ocountry_id');
		var currLocation=document.getElementById('currlocation_id');
		var oCurrLocation=document.getElementById('ocurrlocation_id');

		var ug_course = document.getElementById('ugcourse_id');
		var oug_course = document.getElementById('ougcourse_id');
		var pg_course = document.getElementById('pgcourse_id');
		var ppg_course = document.getElementById('ppgcourse_id');
		var opg_course = document.getElementById('opgcourse_id');
		var oppg_course = document.getElementById('oppgcourse_id');
		var mbatype=document.getElementById('mbatype_id');

		if(ug_course.value!='B.A')
		oug_course.style.display="none";
	
		if(pg_course.value!='Other')
		opg_course.style.display="none";
	
		if(ppg_course.value!='Other')
		oppg_course.style.display="none";
		mbatype.style.display="none";

		if(country.value!='Other')
		oCountry.style.display="none";
		if(!currLocation.value.match('Other'))
		oCurrLocation.style.display="none";
	}
}



function hideOElements_edit_requirement()
{
       if(document.getElementById('edit_resume'))
	{
		var country= document.getElementById('country_id');
		var oCountry=document.getElementById('ocountry_id');
		var currLocation=document.getElementById('currlocation_id');
		var oCurrLocation=document.getElementById('ocurrlocation_id');

		if(country.value!='Other')
		oCountry.style.display="none";
		if(!currLocation.value.match('Other'))
		oCurrLocation.style.display="none";
	}
}


function hideOElements_edit_req()
{
       if(document.getElementById('edit_resume'))
	{
		var country= document.getElementById('country_id');
		var oCountry=document.getElementById('ocountry_id');
		var currLocation=document.getElementById('currlocation_id');
		var oCurrLocation=document.getElementById('ocurrlocation_id');

		var ug_course = document.getElementById('ugcourse_id');
		var oug_course = document.getElementById('ougcourse_id');
		var pg_course = document.getElementById('pgcourse_id');
		var ppg_course = document.getElementById('ppgcourse_id');
		var opg_course = document.getElementById('opgcourse_id');
		var oppg_course = document.getElementById('oppgcourse_id');
		var mbatype=document.getElementById('mbatype_id');

		
		if(country.value!='Other')
		oCountry.style.display="none";
		if(!currLocation.value.match('Other'))
		oCurrLocation.style.display="none";

		if(ug_course.value!='B.A')
		oug_course.style.display="none";
	
		if(pg_course.value!='Other')
		opg_course.style.display="none";
	
		if(ppg_course.value!='Other')
		oppg_course.style.display="none";
		mbatype.style.display="none";

		if(country.value!='Other')
		oCountry.style.display="none";
		if(!currLocation.value.match('Other'))
		oCurrLocation.style.display="none";
	}
}


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 MM_openBrWindow(theURL,winName,features,checktype)
{ //v2.0
  var docF=document.frmPage1;
  window.open(theURL + "?txtuser=" + docF.txtusername.value + "&email=" + docF.txtemail.value + "&chktype="+checktype,winName,features);
}

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;
	}
} // getStyleObject
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;
	}
} // changeObjectVisibility

function showHideOtherOpenBox(callingDDId, openBoxId, otherString)
{
        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 showHideOpenBox(callingDDId, openBoxId, otherString)
{
        otherString = (otherString == null) ? '|Other|' : otherString;
        var callingDD = document.getElementById(callingDDId);
	var openboxDD = document.getElementById(openBoxId);

        var selI = callingDD.selectedIndex;

	var valtoCheck = '|' + callingDD[selI].value + '|';
        if (otherString.indexOf(valtoCheck) != -1)
                changeObjectVisibility(openBoxId, '');
        else
                changeObjectVisibility(openBoxId, 'none');
}

function showHideOtherBox()
{
	var callingDD = document.getElementById('ugcourse_id');
	var selI = callingDD.selectedIndex;
	var myval = callingDD[selI].value
	if(myval=='B.A' || myval=='Other')
		changeObjectVisibility('ougcourse_id', '');
	else
		changeObjectVisibility('ougcourse_id', 'none');
}

function rm_setCountryAreaCode(cntryDDId, currLocnDDId, cntryCodeBoxId, areaCodeBoxId)
{

        countryCode = new Array();
        cityCode = new Array();

/*****************              STD CODES FOR CITIES OF INDIA           *****************/
        cityCode['Ahmedabad'] = "";
        cityCode['Bangalore'] = "";
        cityCode['Chennai'] = "";
        cityCode['Delhi'] = "";
        cityCode['Hyderabad'] = "";
        cityCode['Kolkata'] = "";
        cityCode['Mumbai'] = "";
        cityCode['Pune'] = "";
/* ****************             ISD CODES               **************** */
        countryCode["INDIA"] = "";
/* ************************************************ */

        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(rm_trim(cntryCodeBox.value)=="91")
//                         cntryCodeBox.value = "";
//         }
//         else
//                 cntryCodeBox.value = countryCode[selectedCountry];

        if(cityCode[selectedCity]==null )//&& rm_trim(areaCodeBox.value)=="")
        {
                areaCodeBox.value = "";
        }
        else
                areaCodeBox.value = cityCode[selectedCity];

        if(selectedCountry!="INDIA" && selectedCountry!="select")
        {
                currLocnDD.value = "select";
        }
        else
        if(selectedCountry=="select")
        {
                currLocnDD.value ="select";
        }

}

function showHideCityOpenBox(cityId, ocityId)
{
        cityDD = document.getElementById(cityId);
        var selI = cityDD.selectedIndex;
        if (cityDD[selI].value.match("Other") != null) // selected element contains "other", so show "ocity open box"
                changeObjectVisibility(ocityId, '');
        else
                changeObjectVisibility(ocityId, 'none');
}

// if cntry value is NOT india, then make selected value in city dd as "Other"
function rm_cntryChangedEvent(cntryVal, form_city_id, form_ocity_id)
{
        var cityEle = document.getElementById(form_city_id);

        if (cntryVal == "seedEvent(cntlect")
        {
                cityEle.selectedIndex = 0;
		cityEle.disabled = false;
                showHideCityOpenBox(form_city_id, form_ocity_id);
        }
        else if (cntryVal == 'INDIA' || cntryVal == 'select')
        {
                cityEle.selectedIndex = 0;
                cityEle.disabled = false;
                showHideCityOpenBox(form_city_id, form_ocity_id);
	}
        else	// if (cntryVal != 'INDIA')
        {
                cityEle.selectedIndex = cityEle.length - 1;
		cityEle.disabled = true;
		document.getElementById(form_ocity_id).style.display = "";
                //showHideCityOpenBox(form_city_id, form_ocity_id);
        }
}

// if city value is NOT "Other", then make selected value in cntry dd as india
function rm_cityChangedEvent(cityVal,form_country_id,form_ocountry_id)
{
        if (cityVal != 'Other')
        {
                var cntryEle = document.getElementById(form_country_id);

                for (i = 0; i < cntryEle.length; ++i)
                {
                        if (cntryEle[i].value == "INDIA")
                        {
                                cntryEle.selectedIndex = i;
                                showHideOtherOpenBox(form_country_id,form_ocountry_id);
                                break;
                        }
                }
        }
}
