﻿  
var xmlpage;


function loadpage(name)
{
if (window.ActiveXObject)
  {
  xmlpage=new ActiveXObject("Microsoft.XMLDOM");
  xmlpage.async=false;
  xmlpage.load("doc/"+name+".xml");
  
      }
else if (document.implementation && document.implementation.createDocument)
  {
  xmlpage=document.implementation.createDocument("","",null);
  xmlpage.load("doc/"+name+".xml");
    }
else
  {
  alert('Your browser cannot handle this script');
  }
     
      }

function loadingpage(j)
{

var i=0;
	
var img;
			if (j=7)
			{
			var thisObj = document.getElementById('ctl00_img3');
			var thisObj1 = document.getElementById('ctl00_img4');
			var thisObj2 = document.getElementById('ctl00_img2');
		    var thisObj3 = document.getElementById('ctl00_img0');
			var thisObj4 = document.getElementById('ctl00_img1');
			var thisObj5 = document.getElementById('ctl00_img5');
			var thisObj7 = document.getElementById('ctl00_img6');
            thisObj7.src='images/img6.jpg'
            thisObj5.src='images/b-05.jpg'
		document.getElementById('c').style.display='none';
		thisObj.src='images/b3-g.jpg'
		thisObj1.src='images/b-07.jpg'
		thisObj2.src='images/b-02.jpg'
		thisObj3.src='images/bright-o.jpg'
		thisObj4.src='images/b1-o.jpg'
			}	
	  
			
			

document.getElementById("p").innerHTML=xmlpage.getElementsByTagName("body")[j].childNodes[0].nodeValue;

}
function loadingpage1(j)
{

var i=0;
	
var img;
			if (j=6)
			{
			var thisObj = document.getElementById('ctl00_img4');
			var thisObj1 = document.getElementById('ctl00_img3');
			var thisObj2 = document.getElementById('ctl00_img2');
			var thisObj3 = document.getElementById('ctl00_img0');
			var thisObj4 = document.getElementById('ctl00_img1');
			var thisObj5 = document.getElementById('ctl00_img5');
			var thisObj7 = document.getElementById('ctl00_img6');
            thisObj7.src='images/img6.jpg'
            thisObj5.src='images/b-05.jpg'
		document.getElementById('c').style.display='none';
		
		thisObj.src='images/b4-g.jpg'
		thisObj1.src='images/b-06.jpg'
		thisObj2.src='images/b-02.jpg'
		thisObj3.src='images/bright-o.jpg'
		thisObj4.src='images/b1-o.jpg'
			}	
	  
			
			

document.getElementById("p").innerHTML=xmlpage.getElementsByTagName("body")[j].childNodes[0].nodeValue;

}

var xmlDoc=" ";
function init(name){
		
		
if (window.ActiveXObject)
  {
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.async=false;
  xmlDoc.load("doc/"+name+".xml");
  
      }
else if (document.implementation && document.implementation.createDocument)
  {
  xmlDoc=document.implementation.createDocument("","",null);
  xmlDoc.async=false;
  xmlDoc.load("doc/"+name+".xml");
    }
else
  {
  alert('Your browser cannot handle this script');
  }


//		window.ActiveXObject ? xmlDoc = new ActiveXObject("Microsoft.XMLDOM") 
//				     :  xmlDoc = document.implementation.createDocument("","",null);
//		xmlDoc.async = false;
//		xmlDoc.load("doc/"+ticker+".xml");
		 
		
	}



init('ticker');
var theSummaries = new Array();
var k;
for (k = 0; k <xmlDoc.getElementsByTagName('body').length; k++)
		{

theSummaries[k]=xmlDoc.getElementsByTagName('body')[k].firstChild.data;

}




var theSiteLinks = new Array('#');


	// Control parameters
	var theCharacterTimeout = 50;
	var theStoryTimeout     = 5000;
	var theWidgetOne        = "_";
	var theWidgetTwo        = "-";
	var theWidgetNone       = "";
    var theItemCount = theSummaries.length;
	var NS6=(document.getElementById && !document.all) ? true : false;
	
// Ticker startup

function startTicker()
{

showtime ();
//alert(leadRecipient);
	// Define run time values
	theCurrentStory     = -1;
	theCurrentLength    = 0;
	// Locate base objects
	if (document.getElementById) {	
			runTheTicker();   	
		 }
	else {
           // document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");
            return true;
	}
}
// Ticker main run loop
function runTheTicker()
{
	var myTimeout;  
	// Go for the next story data block
	if(theCurrentLength == 0)
	{
		theCurrentStory++;
		theCurrentStory      = theCurrentStory % theItemCount;
		theStorySummary      = theSummaries[theCurrentStory];
		theTargetLink        = theSiteLinks[theCurrentStory];
	}
	
	var textTitle = theStorySummary.substring(0,theCurrentLength) + whatWidget();
	
	if (theTargetLink ) {
	
		if (NS6) {
	document.getElementById("theTicker").innerHTML  = '<a href="'+ theTargetLink +'" class="siteNavigation">'+textTitle+'</a>';
				 }
		else {
	document.all.theTicker.innerHTML  = '<a href="'+ theTargetLink +'" class="siteNavigation">'+textTitle+'</a>';
				}
						} 	
	else {
		if (NS6) {
	document.getElementById("theTicker").innerHTML = '<span class="tickertext">'+textTitle+'</span>';
				}
		else {
	document.all.theTicker.innerHTML  = '<span class="tickertext">'+textTitle+'</span>';
				}
	}
	
	// Modify the length for the substring and define the timer
	if(theCurrentLength != theStorySummary.length)
	{
		theCurrentLength++;
		myTimeout = theCharacterTimeout;
	}
	else
	{
		theCurrentLength = 0;
		myTimeout = theStoryTimeout;
	}
	// Call up the next cycle of the ticker
	setTimeout("runTheTicker()", myTimeout);
}

// Widget generator
function whatWidget()
{
	if(theCurrentLength == theStorySummary.length)
	{
		return theWidgetNone;
	}

	if((theCurrentLength % 2) == 1)
	{
		return theWidgetOne;
	}
	else
	{
		return theWidgetTwo;
	}

}

var mousex;
var mousey;
function displaycoordNS(e){
mousex=e.clientX;
mousey=e.clientY;
}




function showtooltip(f)
{
init('last');
var rolover= document.getElementById('divpanel');
rolover.style.display='block';
rolover.style.left='10px';


if (window.ActiveXObject)
{rolover.style.top=window.event.clientY|+10;
}
else
{
document.onmouseover=displaycoordNS;
rolover.style.top=mousey+10;
}
 
document.getElementById("spdiv1").innerHTML=xmlDoc.getElementsByTagName('Company')[f-1].firstChild.data;
//document.getElementById("spdiv2").innerHTML=xmlDoc.getElementsByTagName("Cell")[f-1].firstChild.data;
document.getElementById("spdiv3").innerHTML=xmlDoc.getElementsByTagName("Discount")[f-1].firstChild.data;
document.getElementById("spdiv4").innerHTML=xmlDoc.getElementsByTagName("Address")[f-1].firstChild.data;
document.getElementById("spdiv5").innerHTML=xmlDoc.getElementsByTagName("Details")[f-1].firstChild.data;
}
function showtooltiptest(f)
{
init('last');
var rolover= document.getElementById('test');
rolover.style.display='block';
rolover.style.left='10px';


if (window.ActiveXObject)
{rolover.style.top=window.event.clientY|+10;
}
else
{
document.onmouseover=displaycoordNS;
rolover.style.top=mousey+10;
}
 
document.getElementById("span1").innerHTML=xmlDoc.getElementsByTagName('Company')[f-1].firstChild.data;

}




var timerRunning = false;

function stopclock ()
{
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
}

function startclock ()
{
        stopclock();
        showtime();
}

function showtime()
{
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds();
        timeValue = "";
        timeValue += hours;
 timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
       document.getElementById("timer").innerHTML = timeValue;
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
}

function start()
{
showtime();
startTicker();
}



	function keyenglish()
{
if (event.keyCode>1574 && event.keyCode<1690){ 
alert("نام كاربری باید انگلیسی باشد");
return false;}
}




 function RadioChecked(param)
  {
       { 
          var frm = document.forms[0];
       
          for (i=0; i < frm.length; i++)
          {
        
            if (frm.elements[i].type == "checkbox")
            {
          if (param != frm.elements[i].id )
              {
                frm.elements[i].checked = false;
              }
            }
          }
      }
  }



