/* **************************************** */
/* JavaScript Document For ATLAS HONDA LTD. */
/* **************************************** */


/* 
	/////////////////////////////////////////////////////////////////////////////////////////
	
	Function name: open_new_window(page_name, width, height, win_name)
	
	Description	 : The following function will open new window with attributes provided to it
	page name    : the name of page that will be opened. for example, abc.php
	width	     : width of new window. for example 800
	height	     : height of new window. for example 500
	win_name     : name of new window. for example 'cv_window'
	Test Example : open_new_window('abc.php', 800, 500, 'cv_window')
	
	///////////////////////////////////////////////////////////////////////////////////////////

*/

  // Auto increment date used in copyrights portions

  today=new Date();
  auto_year=today.getFullYear();

 ///////////////////////////////


function open_new_window(page_name, width, height, win_name)
{
	
	var theHeight = height;
	var theWidth  = width;
	var win_cv;
	
	var theTop	= (screen.height/2)-(theHeight/2);
	var theLeft	= (screen.width/2)-(theWidth/2);
	
	var option  = "toolbar=0,status=0,menubar=0,scrollbars=yes, width="+theWidth+",height="+theHeight+",top="+theTop+",left="+theLeft;
				
	if ( win_cv == null || win_cv.closed )		// If already any form opened
	{
		win_cv  = window.open(page_name, win_name,option);
		win_cv.focus();
	}
	else
	{
		win_cv.close();
		win_cv  = window.open(page_name, win_name,option);
		win_cv.focus();
	}

}

/* 
	/////////////////////////////////////////////////////////////////////////////
	
	Function name: change_image_over(img_name,img_url)
	
	Description	 : The following function will be called onmouseover event
	img_name	 : name of image tag. for example: <img name='abc'>
	img_url 	 : source/url of image to be shown. for example: 'images/xyz.gif'
	Test Example : change_image_over('abc','images/xyz.gif')
	
	///////////////////////////////////////////////////////////////////////////////
	
*/

function change_image_over(img_name,img_url)
{
	document[img_name].src = img_url;
}

/* 
	///////////////////////////////////////////////////////////////////////////////////////////
	
	Function name: change_image_out(img_name,img_url)
	
	Description	 : The following function will be called onmouseout event.. same as onmouseover 
	img_name	 : name of image tag. for example: <img name='abc'>
	img_url		 : source/url of image to be shown. for example: 'images/xyz1.gif'
	Test Example : change_image_out('abc','images/xyz1.gif')
	
	////////////////////////////////////////////////////////////////////////////////////////////
	
*/


function change_image_out(img_name,img_url)
{
	document[img_name].src = img_url;
}


/*
	
	///////////////////////////////////////////////////////////////////////////////////////////
	
	Function name: onlyDigits(e)
	
	Description	 : The following function will check on keypress event either the entered key is for number or not 
	e			 : catch the event occurred
	Test Example : onKeyPress="return onlyDigits(event);"
	
	///////////////////////////////////////////////////////////////////////////////////////////

*/

function onlyDigits(e)
{
	var unicode=e.charCode? e.charCode : e.keyCode
	
	if( (unicode!=8) && (unicode!=9))
	{ 
		if ((unicode >= 35 && unicode <=39) || (unicode> 47 && unicode <= 57))
			return true
		else
			return false 
	}
}

var url   = "http://www.atlashonda.com.pk"; 
var title = "Atlas Honda Pvt. Ltd";

function myBookmark()
{
	if (window.sidebar) 
	{ // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} 
	else if	( window.external ) 
	{ // IE Favorite
		window.external.AddFavorite( url, title); 
	}
	else if (window.opera && window.print) 
	{ // Opera Browser
		return true; 
	}
}

 
