/* ------------------------------------------------------------
 * Name      : common.js
 * Desc       : Common Index script 
 * Created   : 2009/02/15 common js by Ali Dadgar
 ------------------------------------------------------------ */

//for IE png
function setPng24(obj) { 
	obj.width=obj.height=1; 
	obj.className=obj.className.replace(/\bpng24\b/i,''); 
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
	obj.src='';  
	return ''; 
}


function getCookie(Name){ 
	var re=new RegExp(Name+"=[^;]*", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return null
}

function setCookie(name, value){
 
	if (typeof days!="undefined"){ //if set persistent cookie
		var expireDate = new Date()
		expireDate.setDate(expireDate.getDate()+days)
		document.cookie = name+"="+value+"; path=/; expires="+expireDate.toGMTString()
	}
	else 
	{//else if this is a session only cookie
		document.cookie = name+"="+value
	}
}

var x;
function Found(id)
{
 x=id;
this.setCookie("c",x);
this.setCookie("z","1");
};

function First()
{
this.setCookie("z","0");
}
<!-- Random Golestan window Images -->
var theImageswindow = new Array() 

theImageswindow[0] = '1.gif'
theImageswindow[1] = '3.gif'
theImageswindow[2] = '2.gif'
theImageswindow[3] = '1.gif'
theImageswindow[4] = '1.gif'
theImageswindow[5] = '3.gif'

var j = 0
var p = theImageswindow.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImageswindow[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImagewindow(){
document.write('<img src="common/img/window/'+theImageswindow[whichImage]+'">');
}
<!-- Random windowGolestan Images -->

<!-- Random Golestan visual Images -->
var theImagesvisual = new Array() 

theImagesvisual[0] = '1.jpg'
theImagesvisual[1] = '3.jpg'
theImagesvisual[2] = '4.jpg'
theImagesvisual[3] = '5.jpg'
theImagesvisual[4] = '1.jpg'
theImagesvisual[5] = '3.jpg'

var j = 0
var p = theImagesvisual.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImagesvisual[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImagevisual(){
document.write('<img src="common/img/visual/'+theImagesvisual[whichImage]+'">');
}
<!-- Random Golestan visual Images -->
