function has_vScrollbar(elem_id)
{	
	elem = document.getElementById(elem_id);
	if(elem != null && elem != '' && elem != 'undefined')
	{
		if (elem.clientHeight < elem.scrollHeight)
			return true;
		else
			return false
	}
}

function changecss(theClass,element,value) 
{		
	var cssRules;
	if (document.all) {
	cssRules = 'rules';
	}
	else if (document.getElementById) {
	cssRules = 'cssRules';
	}
	var added = false;
	for (var S = 0; S < document.styleSheets.length; S++){
	for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	if(document.styleSheets[S][cssRules][R].style[element]){
	document.styleSheets[S][cssRules][R].style[element] = value;
	added=true;
	break;
	}
	}
	}
	
	if(!added){
	if(document.styleSheets[S].insertRule){
		  document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
		} else if (document.styleSheets[S].addRule) {
			document.styleSheets[S].addRule(theClass,element+': '+value+';');
		}
	}
	}
}

function setPhoneRowWidth(holder, paramScroll, pramNoScroll)
{	
	/*
	paramScroll[0] = Full Class Name (with .)
	paramScroll[1] = CSS attribute Name (eg. 'color', 'width')
	paramScroll[0] = CSS attribute value (eg. 'red', '100')
	*/

	if(has_vScrollbar(holder))
	{		
		changecss(paramScroll[0], paramScroll[1], paramScroll[2]);
	}
	else
	{
		changecss(pramNoScroll[0], pramNoScroll[1], pramNoScroll[0]);
	}
	
}

function specSideBoxRowEffect(phnID, divEleIdPrefix, targetDivClassName, anchorEleIdPrefix, targetAnchorClassName)
{
	var divEle = document.getElementById(divEleIdPrefix + phnID);
	divEle.className = targetDivClassName;			
	
	var anchorEle = document.getElementById(anchorEleIdPrefix + phnID);
	anchorEle.className = targetAnchorClassName;
}

function detailTopRowHighlight(tdEleme, targetClass)
{
	//alert(tdEleme.childNodes[0]);
	tdEleme.childNodes[0].className = targetClass;
}

//toggle download div on spec details page
function toggleDL()
{
	var detailDLOptionsDIV = document.getElementById('detailDLOptionsID');
	
	if(detailDLOptionsDIV.style.display == 'block')
	{
		detailDLOptionsDIV.style.display = 'none';
	}
	else
	{
		detailDLOptionsDIV.style.display = 'block';
	}
	
}

//bookmark function
function bookmarkPage(title,url)
{
	var agent=navigator.userAgent.toLowerCase(); 	
	
	//alert(agent);	
	if(agent.indexOf("firefox")!= -1) 
	{
		// firefox
		window.sidebar.addPanel(title, url, "");
	}	
	else if(agent.indexOf("msie")!= -1)
	{		
		//ie		
		window.external.AddFavorite(url, title);
	}
	else if(agent.indexOf("chrome")!= -1)
	{		
		//chrome
		reportMsgBox('Press <b>Ctrl+D</b> to Bookmark this page');
	}
	else if(agent.indexOf("opera")!= -1)
	{		
		//opera
		reportMsgBox('Press <b>Ctrl+D</b> to Bookmark this page');
	}
	else if(agent.indexOf("webkit")!= -1 && agent.indexOf("safari")!= -1)
	{		
		//safari
		reportMsgBox('Press <b>Ctrl+D</b> to Bookmark this page');
	}
	else if(agent.indexOf("mac")!= -1)
	{		
		//mac
		reportMsgBox('Press <b>Ctrl+D</b> to Bookmark this page');
	}
	else if(agent.indexOf("konqueror")!= -1)
	{		
		//konqueror
		reportMsgBox('Press <b>Ctrl+D</b> to Bookmark this page');
	}
	else
	{
		reportMsgBox('Press <b>Ctrl+D</b> to Bookmark this page');
	}

}



