function ClassifyResolution(){
	var thiswidth=screen.width;
	var thisheight=screen.height;
	var width3 = 1024; var height3 = 768;
	if(screen.width != width3 && screen.height != height3){ // if the resolution is 1024x768 and index.html is already loaded then no need to call Resolution function
		Resolution();	
	}

}

function FileName()

{

	if (location.href.lastIndexOf('/') !=-1)

	// Check whether '/' exists.

	{

	// If it does then we ...

		firstpos=location.href.lastIndexOf('/')+1;

		/* The URL is 'http://www.trans4mind.com/personal_development/JavaScript2/lastIndexOf.htm' . We use lastIndexOf and we find the last example of '/' - the first position for counting is here. */

		// Find the first position (the file starts after this)

		lastpos=location.href.length;

		/* Normally, the last position of the filename will be at the end of the complete URL - although it could have a # and a name at the end!*/

		Namer=location.href.substring(firstpos,lastpos);
		return Namer;
	}

}


function Resolution(){

var thiswidth=screen.width;
var thisheight=screen.height;


var LoadedFile = FileName();
LoadedFile = LoadedFile.toUpperCase();
 if ((LoadedFile=='INDEX.HTML')|| (LoadedFile=='')){
 	var if640x480 ="index640x480.html"; //file to load if resolution is 640x480:
	var if800x600="index800x600.html";  //file to load if resolution is 800x600:
	var if1024x768="index.html";        //file to load if resolution is 1024x768:
	var if1152x864="index1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="index1280x720.html";// file to load if resolution is 1280x720:
}

else if (LoadedFile=='COMPANY01.HTML'){
	var if640x480 ="company01_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="company01_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="company01.html";        //file to load if resolution is 1024x768:
	var if1152x864="company01_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="company01_1280x720.html";// file to load if resolution is 1280x720:
	
}
else if (LoadedFile=='COMPANY04.HTML'){
	var if640x480 ="company04_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="company04_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="company04.html";        //file to load if resolution is 1024x768:
	var if1152x864="company04_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="company04_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='COMPANY05.HTML'){
	var if640x480 ="company05_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="company05_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="company05.html";        //file to load if resolution is 1024x768:
	var if1152x864="company05_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="company05_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='COMPANY06.HTML'){
	var if640x480 ="company06_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="company06_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="company06.html";        //file to load if resolution is 1024x768:
	var if1152x864="company06_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="company06_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='CONTACT.HTML'){
	var if640x480 ="contact640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="contact800x600.html";//file to load if resolution is 800x600:
	var if1024x768="contact.html";        //file to load if resolution is 1024x768:
	var if1152x864="contact1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="contact1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='CONTACT_WEBSITE_FEEDBACK.ASPX'){
	var if640x480 ="contact_website_feedback640x480.aspx"; //file to load if resolution is 640x480:
	var if800x600 ="contact_website_feedback800x600.aspx";//file to load if resolution is 800x600:
	var if1024x768="contact_website_feedback.aspx";        //file to load if resolution is 1024x768:
	var if1152x864="contact_website_feedback1152x864.aspx";// file to load if resolution is 1152x864:
	var if1280x720="contact_website_feedback1280x720.aspx";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='CONTACT3.HTML'){
	var if640x480 ="contact3_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="contact3_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="contact3.html";        //file to load if resolution is 1024x768:
	var if1152x864="contact3_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="contact3_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='ONLINE_APPLICATION.ASPX'){
	var if640x480 ="online_application640x480.aspx"; //file to load if resolution is 640x480:
	var if800x600 ="online_application800x600.aspx";//file to load if resolution is 800x600:
	var if1024x768="online_application.aspx";        //file to load if resolution is 1024x768:
	var if1152x864="online_application1152x864.aspx";// file to load if resolution is 1152x864:
	var if1280x720="online_application1280x720.aspx";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='PRIVACY.HTML'){
	var if640x480 ="privacy640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="privacy800x600.html";//file to load if resolution is 800x600:
	var if1024x768="privacy.html";        //file to load if resolution is 1024x768:
	var if1152x864="privacy1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="privacy1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='PRODUCTS01.HTML'){
	var if640x480 ="products01_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="products01_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="products01.html";        //file to load if resolution is 1024x768:
	var if1152x864="products01_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="products01_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='SERVICES01.HTML'){
	var if640x480 ="services01_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="services01_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="services01.html";        //file to load if resolution is 1024x768:
	var if1152x864="services01_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="services01_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='SERVICES02.HTML'){
	var if640x480 ="services02_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="services02_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="services02.html";        //file to load if resolution is 1024x768:
	var if1152x864="services02_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="services02_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='SERVICES03.HTML'){
	var if640x480 ="services03_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="services03_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="services03.html";        //file to load if resolution is 1024x768:
	var if1152x864="services03_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="services03_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='SERVICES05.HTML'){
	var if640x480 ="services05_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="services05_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="services05.html";        //file to load if resolution is 1024x768:
	var if1152x864="services05_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="services05_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='SERVICES06.HTML'){
	var if640x480 ="services06_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="services06_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="services06.html";        //file to load if resolution is 1024x768:
	var if1152x864="services06_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="services06_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='SERVICES08.HTML'){
	var if640x480 ="services08_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="services08_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="services08.html";        //file to load if resolution is 1024x768:
	var if1152x864="services08_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="services08_1280x720.html";// file to load if resolution is 1280x720:
}

else if (LoadedFile=='SOLUTIONS01.HTML'){
	var if640x480 ="solutions01_640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="solutions01_800x600.html";//file to load if resolution is 800x600:
	var if1024x768="solutions01.html";        //file to load if resolution is 1024x768:
	var if1152x864="solutions01_1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="solutions01_1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='TERMS.HTML'){
	var if640x480 ="terms640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="terms800x600.html";//file to load if resolution is 800x600:
	var if1024x768="terms.html";        //file to load if resolution is 1024x768:
	var if1152x864="terms1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="terms1280x720.html";// file to load if resolution is 1280x720:
}
else if (LoadedFile=='ADVANTAGE.HTML'){
	var if640x480 ="advantage640x480.html"; //file to load if resolution is 640x480:
	var if800x600 ="advantage800x600.html";//file to load if resolution is 800x600:
	var if1024x768="advantage.html";        //file to load if resolution is 1024x768:
	var if1152x864="advantage1152x864.html";// file to load if resolution is 1152x864:
	var if1280x720="advantage1280x720.html";// file to load if resolution is 1280x720:
}














//file to load if resolution is greater than 1280x720:
//var Redirect ="http://www.google.com";

var msg="Sorry my page cannot be viewed with current resolution.\nCurrent Resolution : "+ thiswidth +' x '+thisheight+"\nTip Set your resolution to 800 x 600.\nRedirecting to google.com";
//location=(Redirect);

var width1 = 640; var height1 = 480;
var width2 = 800; var height2 = 600;
var width3 = 1024; var height3 = 768;
var width4 = 1152; var height4 = 864;
var width5 = 1280; var height5 = 720;

if (screen.width == width1 || screen.height == height1){
  location=(if640x480);}
else if (screen.width == width2 || screen.height == height2){
  location=(if800x600);}
else if(screen.width == width3 || screen.height == height3){
  location=(if1024x768);}
else if(screen.width == width4 || screen.height == height4){
  location=(if1152x864);}
else if(screen.width == width5 || screen.height == height5){
  location=(if1280x720);}  
else
  location=(if1280x720);  
//else if(screen.width >= width6 || screen.height >= height6){
  //alert(msg);
}
